More than 53,000 stranded Americans have been evacuated from countries that closed their borders during the coronavirus pandemic, but few of those nations have posed as many challenges for the State Department as Peru.

The U.S. Embassy in Lima arranged a riverboat operation with the Peruvian navy to get 34 Americans out of the Amazon jungle and onward to the Lima airport. Consular affairs officers chartered buses that traveled up to 18 hours to reach Americans stuck in the mountains near Machu Picchu.

With curfews in place, authorities manning roadblocks asked for permission slips to pass.

About 6,800 Americans have been evacuated from Peru, and 1,800 more have expressed an interest in returning home. Now, the government-chartered rescue flights from Peru are about to be phased out, after a flight Saturday from the Amazon city of Iquitos. In their place, the State Department is arranging irregular flights on commercial airlines. One tour operator already has started soliciting registrations for a private charter flight, and more are expected to follow.

U.S. officials were taken aback by the large number of Americans seeking assistance getting home on government planes, said Julie Chung, the principal deputy assistant secretary of state for Western Hemisphere affairs, who was dispatched to Lima two weeks ago with a team of six consular officers to oversee the evacuations.

“Initially, when we started this evacuation process, people were estimating there were about 5,000 Americans interested in going, and now we’re at 6,800,” Chung said in a telephone interview from the U.S. Embassy in Lima shortly before she left for the airport to return to Washington. “So I think we have now at this point gotten the majority of those who want to leave out.”

The evacuation of tens of thousands of Americans is an unparalleled event, and the State Department has met its share of praise and criticism.

Dan Honig, who teaches international development at the School of Advanced International Studies for Johns Hopkins University, was evacuated from Senegal on April 3 with his wife and young son. Before liftoff, another passenger asked a consular officer wearing full protective gear if he was getting overtime pay.

“No. This is our job,” the man replied, adding, “This is why I signed up for this job. I’m proud to do this — I’m honored to help y’all get home.”

A passenger started clapping, and soon all of about 100 evacuees joined in a round of applause, Honig said.

“Whether you’re on a flight from Senegal or sheltering in place in New York City, or living in a small town in the Midwest, what we’re all struggling with now is uncertainty,” Honig said of the sentiment aboard his evacuation flight. “I know of no better way to give confidence to those facing uncertainty than to know we’re in capable hands.”

But the State Department’s initially slow evacuation from Peru was chastised by members of Congress and some Americans who complained of being abandoned by the embassy. They shared their grievances on Twitter using the hashtag #StuckInPeru.

Chung said their anger was understandable.

“If it were my mother or daughter stuck in a corner of Peru, I’d be frustrated and angry, too,” she said.

The evacuations from Peru were complicated, Chung said. They required getting Americans out of remote locations, converting a hangar into a waiting room and calling Peruvian government officials at the federal, regional and local levels to get the necessary permissions to leave through a closed airport.

In between, she also had to register her concern to government officials when Americans at a hostel in Cusco said they had been sprayed with bleach before leaving.

“The suddenness of the ­closure of the borders, the suddenness of the closure of the airport and having to develop a hangar from scratch, and develop our own processes, those all contributed to the challenges of the Peruvian situation,” Chung said.

Arranging the evacuations was also complicated by problems associated with the passengers. In India, where thousands of Americans were seeking to leave, manifests were drawn up but only 40 percent of the would-be passengers on some flights decided to leave, said Ian Brownlee, the head of the State Department’s repatriation task force.

Some of the initial flights out of Peru left with empty seats because there were so many no-shows.In one case, a couple decided not to leave after their adult children had already added their parents to the manifest. A family of five decided at the last moment to stay in the country.

About 20,000 Americans are seeking State Department assistance in getting home. The number fluctuates daily, as more countries close their borders. In Africa, embassies are registering smaller numbers of citizens seeking help, but the pickup is still complex.

“They’re making milk runs, with multiple stops across the continent,” Brownlee said. “Twenty here, 30 there.”

The lesson from Peru, Chung said, is to let Americans know that they haven’t been forgotten.

“During a time of crisis, communication — and overcommunication — is important,” she said. “The more information that we provide, it provides reassurances for American citizens.”