(CNN) Low-flying military jets buzzed over Turkey's capital of Ankara. Soldiers blocked major bridges in Istanbul. State-run television announced that the military had imposed martial law.
Where is President Recep Tayyip Erdogan during Turkey's coup attempt? In an interview via FaceTime on CNN Turk television, he urged people to take to the streets against the military. He vowed to return Ankara. His location was unclear.
"This was done from outside the chain of command," he said, adding that lower-ranking officers had rebelled against senior officers.
"In history, nowhere in the world has a coup been successful," Erdogan added. "Sooner or later, they all fail."
Meanwhile, thousands across Istanbul and Ankara began flooding the streets alongside military tanks.
Famously sensitive to criticism, Erdogan is no stranger to controversy. Here's how he rose to power and divided a country.
Failed military coup in Turkey
Police try to stop people from attacking a judge, suspected in the failed coup plot, in Erzurum, Turkey on Tuesday, July 19. Turkey has fired or suspended about 50,000 people as the government intensifies a crackdown following last weekend's failed coup attempt. Teachers, journalists, police and judges have been affected.
Police escort Turkish soldiers, accused of taking part in the attempted coup, as they leave a courthouse in Istanbul's Bakirkoy neighborhood on Saturday, July 16.
Turkish police officers cover the eyes of soldiers as they are transported in a bus from the courthouse in Istanbul on July 16.
Akin Ozturk, front row, center, a four-star general and former commander of the Turkish air force, is among those in police custody whom President Recep Tayyip Erdogan's government has accused of having led the failed coup attempt.
In a mass detention in Ankara, dozens of detainees are forced to kneel, partially stripped.
A man waves a Turkish flag from a car roof during a July 16 march around Kizilay Square in Ankara after the attempted military coup.
Damaged vehicles are abundant outside the presidential palace in Ankara on July 16.
People kick and beat a Turkish soldier suspected in the attempted coup on Istanbul's Bosphorus Bridge on July 16.
Women react after people took over a military position on the Bosphorus Bridge in Istanbul.
People gather outside the Turkish Parliament in Ankara during an extraordinary session after the failed coup attempt.
Turkey Prime Minister Binali Yildirim addresses the Turkish Parliament after the failed coup attempt.
A protester rests on a bench as smoke billows from the Turkish military headquarters in Ankara.
People stand under a huge Turkish flag during a march around Kizilay Square in Ankara in reaction to the attempted coup.
Members of the Turkish military surrender on Istanbul's Bosphorus Bridge on after a failed coup attempt.
People protesting against the coup wave a Turkish flag on top of a monument in Istanbul's Taksim Square.
Clothes and weapons belonging to soldiers involved in the coup attempt are scattered on Bosphorus Bridge in Istanbul.
A Turkish police officer in Istanbul embraces a man on a tank in the wake of the violence overnight.
Smoke billows from the direction of the Presidential Palace in Ankara on July 16.
People gather on top of a Turkish military tank in Ankara in the morning after the coup attempt. National intelligence officials said the coup was put down and that the government remains in control.
Turkish people wave national flags from a car in Istanbul.
People gather around a car damaged by a tank in Kizilay Square early on July 16.
People take to the streets near the Fatih Sultan Mehmet Bridge during clashes with military forces in Istanbul.
People escape the clashes in Ankara early Saturday.
Tanks move into position as Turkish citizens attempt to stop them in Ankara.
Citizens in Sivas rush to the streets during the chaotic coup attempt.
A man approaches Turkish military with his hands up at the entrance to the partially closed Bosphorus Bridge in Istanbul.
A wounded man is given medical care at the entrance to the Bosphorus Bridge in Istanbul after clashes with Turkish military.
People react in front of the Justice and Development Party's headquarters in Karabuk.
Soldiers secure an area as supporters of Turkish President Recep Tayyip Erdogan protest in Istanbul's Taksim Square.
Turkish military members make their way through the streets of Istanbul.
Supporters of President Recep Tayyip Erdogan protest in front of soldiers in Istanbul's Taksim Square.
President Recep Tayyip Erdogan speaks on CNN Turk via a FaceTime call in Istanbul after members of the country's military attempted to overthrow the government.
Turkish soldiers block Istanbul's iconic Bosphorus Bridge.
Turkish security officers detain police officers, seen in black, in Istanbul, during a security shutdown on the Bosphorus Bridge.
A military airplane is seen flying over Turkey. President Recep Tayyip Erdogan urged people to take to the streets and stand up to the military.
People take cover near the Bosphorus Bridge as military airplanes fly overhead.
Turkish soldiers are seen on the Asian side of Istanbul.
A Turkish security officer stands guard on the side of the road.
Turkish soldiers block Istanbul's Bosphorus Bridge.
The bitter divide over a leader
"So long as you love the people sincerely and deeply, people will love you," Erdogan told CNN in March.
But the population is bitterly divided between citizens who love -- or loathe -- their president.
Along with deadly jihadist bombings and rising tensions with the country's largest ethnic minority, Turkey is perhaps more internally politically polarized than ever.
Since the beginning of the Syrian uprising, Erdogan has used the conflict as an opportunity to crack down on the Kurdish Workers Party (PKK). The militant group has been battling the Turkish state for decades and is listed as a terrorist organization by NATO, the U.S. and the EU.
The strategy "stoked the fires of Kurdish grievances, and the PKK returned the favor in-kind -- ratcheting up its terror attacks on the Turkish state, mainly against security institutions like the police, which have increased in number and frequency over the past five years," according to Lina Khatib, head of the Middle East and North Africa Programme at Chatham House.
But Erdogan also benefited. He used the attacks to portray himself as the man protecting the nation from terrorism.
However, Erdogan's image has been tarnished by strict internet censorship -- Twitter, Facebook and YouTube are frequently blocked in Turkey -- and the wholesale sacking of police officers and prosecutors who had investigated his government for corruption.
'I'm not at war with the press'
In March, Erodgan's critics accused him of launching a nationwide crackdown on dissent in the media -- and society at large.
Turkish authorities seized control of the country's largest newspaper earlier this year. Turkish journalists were tried for espionage after publishing a video allegedly showing the intelligence agency funneling weapons into Syria.
"I'm not at war with the press," Erdogan insisted.
Insulting the president is a crime in Turkey. More than 1,800 cases have been filed since Erdogan took office in 2014, according to the country's Justice Minister.
Turkey's troubled relationship with the media has long been a point of contention for the European Union, which has said freedom of the press and of expression are nonnegotiable conditions for joining the EU. Erdogan has called these concerns "irrelevant obstacles."
From prime minister to president
Erogan is the co-founder of Turkey's ruling Justice and Development Party (AKP). He was elected prime minister in 2003. Under his rule, Turkey became a powerhouse in the Middle East. His reign came to an end in 2014, and his own party's rules prevented him from seeking a fourth term. So, he ran for president -- and won.
Before this, the president of Turkey was a largely ceremonial role, but Erdogan tried to change that by altering the constitution to give him more power.
The 2015 election resulted in a hung Parliament, leading to sweeping anti-government protests and terror attacks. Turkey held a snap election, and with that, Erdogan's AK Party regained control.
Under Erdogan, who is extremely conservative, religion has started to play a more important role in Turkey, which is a largely secular country. He was active in Islamist circles in the 1970s and 1980s.
A champion of pious, working class Turks, Erdogan had until recently presided over a prolonged period of economic expansion.
But the heady days when Erdogan pushed reformist agenda and lobbied to win Turkey's membership in the European Union have long faded.
CNN's Amanda Wills, Ivan Watson, Juliet Perry, Gul Tuysuz and Jo Shelly contributed to this report.