Rebel commandos barged into an Aegean resort hotel with a key mission: capture Turkish President Recep Tayyip Erdogan.
He had been vacationing there. At first, the soldiers couldn't find his villa. When they finally did, the president was long gone. The soldiers were at least an hour late.
They took a top presidential aide hostage as well as two bodyguards. But Erdogan was already on a jet.
His escape stands as the biggest blunder of the coup plotters who tried and failed to overthrow him. But it was far from their only one.
The string of errors suggested a coup attempt that was poorly planned and coordinated. Despite a long history of frequent coups in modern Turkey, the rebels seemed to bumble through some of the most basic aspects of seizing power.
To begin with, the dissident generals who organized the coup attempt also failed miserably at public relations.
The plotters seized the two bridges over Istanbul's Bosporus strait and the control tower at the city's main airport and attacked the MIT national intelligence agency, a major police headquarters, the parliament and the presidential palace in the capital, Ankara.
But they forgot to say who they were and what they were up to.
Binali Yildirim, the prime minister, beat them to it. Speaking to the news media at 11 p.m. Friday, about an hour into the coup attempt, as tanks sent by the would-be junta were rolling through Ankara toward his office, he said that a group in the Turkish military was attempting to topple the government but would fail.
It wasn't until 12:15 a.m. Saturday that the coup plotters took control of the state television broadcaster in Ankara, pointed guns at a news reader and forced her to read a statement declaring their armed takeover.
The statement identified them for the first time by their preferred name, the "Peace at Home Council," a reference to a famous phrase of Kemal Ataturk, the staunchly secularist founder of the modern Turkish republic, who spoke of "peace at home, peace in the world." The name choice was the first indication that at least some of the coup leaders were unhappy about Erdogan's moves to elevate the role of Islam in state affairs.
Minutes after the statement was read, the president responded, possibly from his vacation villa. Blocked from state television, he called the private television network, CNN Turk, using Facetime on his iPhone and exhorted the Turkish public to take to the streets to oppose the coup.
He said the coup attempt was being conducted by a "minority within the military" with links to with Fethullah Gulen, a Muslim preacher living in self-exile in the United States, and warned that the plotters would "pay the highest price at the end." He said that he would return to Ankara.
Erdogan got on a helicopter on the advice of a trusted military general, flew to Dalaman airport, near the Aegean coast, and boarded a business jet. But instead of returning to the capital, he flew to Istanbul.
That carried its own risks, because the control tower was still under the control of the coup plotters, who had turned off the runway lights and easily could have been using parked vehicles to block landings.
The president discussed the dangers with the pilot, he later told his justice minister, Bekir Bozdag, asking: "Can you land with your own lights even if they don't allow you to land?"
With enough fuel to fly for four hours, the president and the pilot had many options. Finally, they agreed to circle the airfield before deciding whether to land using only the lights of the plane.
They touched down in Istanbul shortly before 3 a.m.
Back in the Aegean coastal town of Marmaris at the Turban hotel, where Erdogan had been vacationing, the rebel commanders had just arrived.
Three helicopters deposited more than two dozen soldiers in red berets and camouflage uniforms, according to Ali Gundogan, a local journalist who had come on his motorbike and climbed over a hotel wall. "I came face to face with them," he said.
"Shoot him!" one of the men ordered.
"I am a journalist," said Gundogan, who added that he showed them his video camera and refused to leave.
The soldiers circulated among the hotel guests and security staff, asking for directions to the president's villa, "since they didn't know the exact location," he said.
When they found the villa, they threatened to throw a grenade inside. Fahri Kasirga, the secretary-general of the presidency, and two presidential bodyguards were still at the hotel. The soldiers took all three hostage.
As the night wore on and they were unable to find the president, the soldiers told Gundogan that they had no intention of harming him or anyone else. It seemed they intended only to capture the president and not kill him.
The town mayor, Muhammet Ali Acar, said that the soldiers had fired in the air upon arriving at the hotel and that panicked guests called the police to report that armed men had taken over.
When large numbers of police finally arrived about 4:30 a.m. and tried to arrest the renegades, a gun battle ensued in which a policeman and a bodyguard were killed, the mayor said.
Eventually about 15 of the soldiers got back in their helicopters and flew off, while the rest fled on foot.
"They left all their machine guns in the hotel rooms," said Gundogan. "I guess they didn't want to carry any heavy equipment with them."
Gutman is a special correspondent.