* Investigation challenges authority of PM Erdogan
* Thousands in Istanbul call on government to resign
* Furore has exposed rift between PM, Islamic cleric
* Erdogan speaks in northern cities, thousands show support
By Ece Toksabay and Humeyra Pamuk
ANKARA, Dec 22 (Reuters) - Thousands took to the streets of Istanbul on Sunday to protest against the government over a corruption scandal that has led to multiple arrests and exposed a rift between Prime Minister Tayyip Erdogan and an influential U.S.-based Muslim cleric.
Twenty-four people, including the sons of two ministers and the head of state-owned Halkbank, have been formally charged in connection with the corruption inquiry that Erdogan has called a "dirty operation" to undermine his rule.
In response, Erdogan has sacked or moved to different posts about 70 police officers, including the powerful head of Istanbul's force, in a widening crackdown on the force that launched the investigation.
Erdogan drew thousands of cheering supporters when he toured the north of the country on Sunday.
But in Istanbul, anti-government demonstrators flooded into Kadikoy Square, where a protest against government urbanisation plans had been scheduled to take place, before they were largely dispersed by police firing teargas and water cannon.
"Everywhere is (Erdogan's) AK Party, everywhere is corruption," they chanted, a reference to the slogan of summer anti-government protests that centred on Istanbul's Taksim Square, "Everywhere is Taksim, everywhere is resistance".
As in the case of the summer protests, the fiercest since he came to power in 2002, Erdogan has pointed to foreign hands in the crisis.
"They are setting wicked and dark traps in our country, using their local pawns to disrupt Turkey's unity and integrity," Erdogan said in the Black Sea city of Giresun on Sunday.
The Economy Minister and Interior Minister, whose sons were among the 16 arrested on Saturday, echoed Erdogan on Sunday, saying via Twitter and the media that the allegations were part of 'big trap'.
Witnesses estimated the crowd in Kadikoy Square grew to as much as 10,000 at one point.
"This gang of thieves cannot be ruling this country. The government should resign and all the dirty hands must be tried," said Pelin Demirci, 26, who carried a banner that read "AKP get your dirty hands off our pockets."
The crisis, the most serious challenge to Erdogan in his 11 years as Turkey's leader, is seen as the result of a growing rift between Erdogan and his former ally Fethullah Gulen, a cleric with quiet influence in the police and the judiciary.
Erdogan has refrained from naming Gulen, but years of disagreements between the two men spilled out into the open last month over a government plan to abolish private "prep" schools, including those run by Gulen's Hizmet movement.
Erdogan's position is under no immediate threat, but the row could help decide local elections due in March. Gulen had helped Erdogan's Islamist-rooted AK Party win a growing share of the vote in three successive elections.
The prime minister has said the crackdown on people behind the corruption investigation would continue.
"Those who cast slurs on my ministers to reach their dirty goals, you should know that this nation will spoil the game. We will break those hands if they are trying to set traps in this country," Erdogan said on Sunday.
Those who attended Sunday's protest in Istanbul appeared more concerned with the issue of corruption than the Gulen-Erdogan split.
"The people are not interested in the power struggle between Erdogan and Hizmet. The most important thing is to catch the thieves and put them in front of justice," said Kadir Cekic, 26, an engineer who works in the auto industry.
"I believe neither of them are innocent anyway, but for AK Party's electorate to wake up and see some of the realities, these operations are very helpful."