The United States withdrew its remaining diplomatic staff from the embassy in Caracas, Venezuela. (Juan Barreto/AFP/Getty Images)

The last remaining U.S. diplomats in Caracas shuttered the embassy and left Venezuela on Thursday, but Secretary of State Mike Pompeo said they will return once the transition to democracy begins.

The departure of about 20 diplomatic personnel puts an end to a U.S. presence in Venezuela at a time of high tension, with Nicolás Maduro and Juan Guaidó, the National Assembly head, both claiming to be the country’s legitimate president.

Maduro’s government has accused the United States and Guaidó of sabotaging Venezuela’s electrical system and seeking to overthrow him. U.S. officials have repeatedly warned Maduro not to threaten Guaidó, who is recognized as president by the United States and more than 50 other countries.

“We hold former president Maduro and those who surround him fully responsible for the safety and welfare of Interim President Guaidó and his family,” State Department spokesman Robert J. Palladino said Thursday. “And it would be a terrible mistake for the illegitimate Maduro regime to arrest Interim President Guaidó and provoke immediate reaction from Venezuelans and the international community.”

Since recognizing Guaidó in January, the Trump administration has imposed sanctions on the state-owned oil company and members of Maduro’s inner circle, and said more sanctions are imminent. It also has revoked visas for over 600 Venezuelans close to Maduro and flown tons of humanitarian aid to the border with Colombia and Brazil.

But Maduro retains the backing of Cuba and Russia, and appears to have the support of Venezuela’s military commanders.

Most of the U.S. diplomatic staff was ordered home weeks ago, leaving a core group behind. Pompeo decided to pull the rest out as the embassy struggled to keep going without fresh water or fuel for generators.

“The United States government, at all levels, remains firm in its resolve and support for the people of Venezuela and Interim President Juan Guaidó,” Pompeo said in a statement. “We look forward to resuming our presence once the transition to democracy begins.”

The giant U.S. flag was lowered at 6 a.m. Thursday at the sprawling hillside embassy in Caracas, and the diplomats left for the airport at 10:30 a.m. By afternoon, only a few Venezuelan police and security guards were visible at the entrance of the facility.

Maduro said in a speech this week that he hoped the U.S. and Venezuelan governments could continue negotiations to set up interest sections in each other’s capital — even as he blamed Washington for a massive five-day blackout that began last Thursday and brought the South American country to a virtual halt.

Maduro was fiercely critical of national security adviser John Bolton and Elliott Abrams, the U.S. special envoy for Venezuela. But he was remarkably complimentary of the charge d’affaires, James “Jimmy” Story, whom he described as professional, though he said they had not met.

“I congratulate him for the work he did,” Maduro said in a speech Tuesday. “Bye-bye.”

In remarks to the Venezuelan staff who turned out to bid farewell to the departing diplomats, Story acknowledged that their health and safety were at risk as the country’s economy and infrastructure collapse.

“We will soon return to a democratic and free Venezuela where the Venezuelan people are able to exercise their individual rights, live in freedom, and be able to build a future of dignity for themselves and their families,” he said, according to a transcript provided by the State Department.

“We know we will return to this beautiful country soon because the path that you, the Venezuelan people, have taken for yourself, is irreversible.”

The diplomats, and the Marine guards who have protected them and the embassy grounds, flew out of Simón Bolívar International Airport at 1:10 p.m. in an unmarked, chartered civilian plane. They secured the assent of the Maduro government for the plane to be treated as a diplomatic carrier, so no one and nothing aboard was searched.

“Let’s say we had things that weighed quite a bit that would require a civilian charter plane,” Palladino acknowledged.

The diplomats returned to the United States and will continue to work on Venezuela issues as the United States steps up its pressure on Maduro and his inner circle with more sanctions and visa revocations in an attempt to get him to step down.

“U.S. diplomats will now continue that mission from other locations where they will continue to help manage the flow of humanitarian assistance to the Venezuelan people and support the democratic actors bravely resisting tyranny,” Pompeo said in a statement.

The progress of the embassy’s shutdown, and the diplomats’ departure, was closely monitored in the Operations Center in the State Department, down the hall from the secretary of state’s suite.

A rotating crew of diplomats gathered around computer screens lined up on a conference table strewn with half-empty boxes of Girl Scout cookies, energy bars, water bottles and a large bottle of hot sauce. Two television sets were turned to news, one to the BBC and one to Globovision, a Venezuelan television station. Neither had news of the U.S. diplomats inching toward the airport, and their only communication with the personnel in Caracas was through messages, calls and photos on WhatsApp.

The atmosphere in the room was a brew of tension and emotion, particularly for the diplomats who had been ordered to leave Caracas five weeks ago and were reliving the emotions of their departure. Some of them passed around photographs taken in Venezuela, showing Marine guards folding the flag outside the embassy and Story locking the embassy’s steel door. Several expressed concern for friends and co-workers still there.

As the hour for the scheduled departure approached, occasionally a landline phone rang, prompting everyone to stop moving and breathing. But it was just a call from inside the State Department, asking if the plane had taken off. One diplomat who had been ordered to depart Venezuela earlier checked her cellphone for videos sent by former co-workers, showing the plane slowly taxiing down the runway.

Another diplomat received a WhatsApp message from a Venezuelan co-worker saying, “Nice working with you. Pray for us.”

At 1:11 p.m., one minute after takeoff, an alert was sent around the State Department, using an acronym for diplomatic personnel, who are referred to internally as direct hires:

“All remaining USDH are wheels up from the Simon Bolivar International Airport en route to U.S. territory.”

Sheridan reported from Caracas.