* Erdogan says coup plotters will pay heavy price

* Military said martial law imposed, “peace council” to rule

* Supporters answer Erdogan call to take to the streets

* U.S. declares support for elected government

* 42 people, mostly civilians killed in Ankara - senior official

An attempted Turkish military coup appeared to crumble on Saturday after crowds answered President Tayyip Erdogan's call to take to the streets to support him and dozens of rebel soldiers abandoned their tanks in the main city of Istanbul.

At least 60 people were killed in violence that erupted on Friday after a faction of the armed forces attempted to seize power, officials said.

A successful overthrow of Erdogan, who has ruled Turkey since 2003, would have marked one of the biggest shifts in the Middle East in years, transforming one of the most important US allies while war rages on its border. A failed coup attempt could still destabilise a pivotal country.

Erdogan, who had been holidaying on the southwest coast when the coup was launched, flew into Istanbul before dawn on Saturday and was shown on TV among a crowd of supporters outside Ataturk Airport.

The uprising was an “act of treason", and those responsible would pay a heavy price, he told reporters at a hastily arranged news conference. Arrests of officers were under way and it would go higher up the ranks, culminating in the cleansing of the military, he said.

Addressing a crowd of thousands of flag-waving supporters at the airport later, Erdogan said the government remained at the helm, although disturbances continued in Ankara.

However, in an emailed statement from the Turkish military General Staff's media office address, the pro-coup faction said it was determinedly still fighting.

Calling itself the Peace at Home Movement, the faction also called on people to stay indoors for their own safety.

Rebel soldiers who had taken control of military aircraft were still firing from the air and fighter jets had been scrambled to intercept them, Prime Minister Binali Yildirim said, underscoring the ongoing uncertainty.

Gunfire and explosions had rocked both Istanbul and Ankara in a chaotic night after soldiers took up positions in both cities and ordered state television to read out a statement declaring they had taken power.

Around 50 soldiers involved in the coup surrendered on one of the bridges across the Bosphorus Strait in Istanbul after dawn on Saturday, abandoning their tanks with their hands raised in the air. Reuters witnesses saw government supporters attack the pro-coup soldiers who had surrendered.

Earlier, around 30 pro-coup soldiers had surrendered their weapons after being surrounded by armed police in Istanbul's central Taksim square.

They were taken away in police vans as a fighter jet repeatedly screeched overhead at low altitude, causing a boom that shook surrounding buildings and shattered windows.

LAWMAKERS IN HIDING

The coup began with warplanes and helicopters roaring over Ankara and troops moving in to seal off the bridges over the Bosphorus Strait that links Europe and Asia in Istanbul.

Authorities had shut the strait to tanker traffic, shipping agent GAC said.

By the early hours of Saturday, lawmakers were still hiding in shelters inside the parliament building in Ankara, which was being fired on by tanks. Smoke rose up from nearby, Reuters witnesses said. An opposition MP told Reuters parliament was hit three times and that people had been wounded.

A senior Turkish official said later on Saturday attacks on the parliament had “largely stopped".

A Turkish military commander also said fighter jets had shot down a helicopter used by the coup plotters over Ankara. State-run Anadolu news agency said 17 police were killed at special forces headquarters there.

Momentum turned against the coup plotters as the night wore on. Crowds defied orders to stay indoors, gathering at major squares in Istanbul and Ankara, waving flags and chanting.

“We have a prime minister, we have a chief of command, we're not going to leave this country to degenerates,” shouted one man, as groups of government supporters climbed onto a tank near Ataturk airport.

Erdogan and other officials blamed the attempted coup on followers of Fethullah Gulen, an influential cleric in self-imposed exile in the US who once supported Erdogan but became a nemesis.

The pro-Gulen Alliance for Shared Values said it condemned any military intervention in domestic politics.

US Secretary of State John Kerry said he phoned the Turkish foreign minister and emphasised “absolute support for Turkey's democratically elected, civilian government and democratic institutions".

Turkey, a NATO member with the second biggest military in the Western alliance, is one of the most important allies of the US in the fight against the Islamic State militant group, which seized swaths of neighbouring Iraq and Syria.

European Council President Donald Tusk called for a swift return to Turkey's constitutional order, saying tensions there could not be resolved by guns.

“Turkey is a key partner for the European Union. The EU fully supports the democratically elected government, the institutions of the country and the rule of law,” Tusk said at regional summit in Mongolia.

SOCIAL MEDIA CUT OFF

Airports were shut and access to internet social media sites was cut off in the first hours of the coup attempt. Flag carrier Turkish Airways resumed flights on Saturday, Erdogan said.

Malaysia Airports, the operator of Sabiha Gokcen International Airport, Istanbul's second airport, said it would continue to process flights in and out of Turkey.

Soldiers took control of TRT state television, which announced a countrywide curfew and martial law. An announcer read a statement on the orders of the pro-coup faction that accused the government of eroding the democratic and secular rule of law. Turkey would be run by a “peace council” that would ensure the safety of the population, the statement said.

TRT went off the air shortly afterwards. It resumed broadcasting in the early hours of Saturday.

Reuters reporters saw a helicopter open fire in Ankara. Anadolu news agency said military helicopters had fired on the headquarters of the intelligence agency.

The coup had appeared strong early on Friday evening. A senior EU source monitoring the situation said: “It looks like a relatively well-orchestrated coup by a significant body of the military, not just a few colonels ... They control several strategic points in Istanbul.”

One European diplomat was dining with the Turkish ambassador to a European capital when guests were interrupted by the pinging of urgent news on their mobile phones.

“This is clearly not some tinpot little coup. The Turkish ambassador was clearly shocked and is taking it very seriously," the diplomat told Reuters as the dinner party broke up. “However it looks in the morning, this will have massive implications for Turkey. This has not come out of nowhere.”

Turkey is one of the main backers of opponents of Syrian President Bashar al-Assad in that country's civil war, host to 2.7 million Syrian refugees and launchpad last year for the biggest influx of migrants to Europe since World War Two.

Celebratory gunfire erupted in Syria's capital Damascus after the army claimed to have toppled Erdogan. People took to the streets to celebrate there and in other government-held cities.

Turkey has been at war with Kurdish separatists and has suffered numerous bombing and shooting attacks this year, including an attack two weeks ago by Islamists at Ataturk airport that killed more than 40 people.

After serving as prime minister from 2003, Erdogan was elected president in 2014 with plans to alter the constitution to give the previously ceremonial presidency far greater executive powers.

Turkey has enjoyed an economic boom during his time in office and has dramatically expanded its influence across the region. However, opponents say his rule has become increasingly authoritarian.

His AK Party, with roots in Islamism, has long had a strained relationship with the military and nationalists in a state that was founded on secularist principles after World War One. The military has a history of mounting coups to defend secularism, but has not seized power directly since 1980.