— Thirteen years ago, U.S. Marines sneaked across the Pakistani border into what was then Taliban-controlled Afghanistan. On Monday, the last Marines sneaked out, leaving behind a province that is still battling the influence of the Taliban.

In an elaborate 20-hour departure mission kept secret to evade attack, the Marines and British forces ended their operations in Afghanistan by withdrawing from Helmand province after more than a decade of battles there tested both militaries’ ability to fight in a landlocked nation.

Located in rugged southern Afghanistan, Helmand was the site of some of the bloodiest battles of the war, and the province came to symbolize the coalition’s broader struggle to contend with the country’s tribal rivalries, porous border and lucrative poppy trade. Since the forces arrived in Afghanistan in 2001, about 350 Marines and 407 British soldiers have been killed in Helmand.

About 24,000 U.S. troops remain in Afghanistan, most on four large NATO coalition bases, but President Obama plans to more than halve that number by January and reduce it further in 2016. What happens next in Helmand, where Afghan security forces are now in charge, will serve as an early barometer of whether such a rapid drawdown can take place without leading to more violence in the country.

“We are doing exactly what our commander in chief has asked us to do,” Capt. James  M. Geiger Jr., commander of a U.S. Marine weapons company, said late Sunday, a few hours before he started his journey back to the United States. “We have taken great pride in this mission. We are the last Marines and were protecting the reputations of our brothers who paid the ultimate price.”

But the final hours of the Marines’ pullout illustrated how unfinished the mission in Helmand remains. Worried about a Taliban attack, the forces left Camp Leatherneck and Camp Bastion, two of the war’s most important bases, under tight security and a media blackout about troop movements.

The first wave of the withdrawal began around dusk Sunday, as C-130 aircraft began descending onto the airstrip to pick up remaining supplies. Troops, meanwhile, huddled around fire pits and burned old uniforms and classified paperwork that they didn’t want to fall into the hands of insurgents.

“Everyone has done what they can do, and I do feel like the Afghans are ready to take over,” said Sgt. Enrique Enriquez, 29, of El Paso, before he set out to man his post for the final time. “That is why I feel like it’s time for us to get out of here.”

Around 6 a.m. Monday, Geiger began overseeing the withdrawal of the front-line troops posted on the outer reaches of the two bases, a combined 6,500 acres of desert land. But the Afghan soldiers who were supposed to replace them on the northern perimeter were 10 minutes late, requiring commanders to temporarily dispatch assault helicopters to bolster security.

“We’ll help them out,” Geiger said of the Afghan forces. “We know how to meet a timeline.”

Afghan troops picked up the pace and began manning security at the outer posts by 7:58 a.m., two minutes ahead of schedule. That allowed the Marines to focus on protecting the immediate area around the airstrip so C-130s and transport helicopters could pick up Marines, their weapons and hundreds of thousands of rounds of ammunition.

By 11:30 a.m., the last Marines and British troops in Helmand flew out, in a formation of eight helicopters.

U.S. Marines board a C-130J Super Hercules transport aircraft headed to Kandahar as British and U.S. forces withdraw from the Camp Bastion-Leatherneck complex at Lashkar Gah in Helmand province. (Wakil Kohsar/AFP/Getty Images)

“It was an amazing moment, but surreal,” Capt. Anthony Nguyen, 33, a Marine from Houston, said after arriving in neighboring Kandahar province on one of the last flights. “We are not refugees or anything, but it kind of reminded me of scenes of Vietnam, of people running to the helicopters.”

The symbolism of the moment was not lost on Brig. Gen. Daniel D. Yoo, commander of Marine Expeditionary Brigade Afghanistan. He left Helmand nearly 13 years after he first arrived.

In November 2001, in the aftermath of the Sept. 11 attacks, Yoo was the operations commander for a Marine amphibious assault that secretly landed in Pakistan to kick off the war in Afghanistan. Yoo then led U.S. forces opening up a southern flank of the war, pushing through Helmand before setting up a base of operations in Kandahar province.

Yoo, who did three tours in Afghanistan and this year oversaw coalition efforts in the country’s southwest, including Helmand, said he has watched the Afghan army and police become stronger and local residents gain access to technology such as cellphones. But he acknowledged that the Taliban, as well as Helmand’s criminal gangs and drug runners, still have too much influence in the province.

“We can adapt to the environment, but, quite honestly, being in a landlocked country this long is probably not our forte,” Yoo said. “We have always said we are an expeditionary force and naval in character, but we will do what our country needs us to do, and I think we have done very well in a landlocked country.”

In recent weeks, there have been numerous Afghan news media reports that some districts of Helmand are in danger of being overrun by the Taliban.

“It’s much, much worse compared to last year,” said Mir Wali Khan, a parliament member from Helmand province. “Without support from foreign troops, they do not have the support. So with the withdrawal, it will only get worse, and our Afghan forces will not be able to fight against the enemy.”

But coalition and Afghan commanders say the reported strength of the Taliban is exaggerated. They say Afghan forces control all population centers in Helmand. Afghan forces also repeatedly repelled Taliban attacks on checkpoints during the summer fighting season, officials said.

“We have been training and planning for a very long time, and everything is ready,” Gen. Zamin Hassam, chief of staff for the Afghan army’s 215 Corps, said Monday morning as he watched his troops take over responsibility for manning the main checkpoint into Camp Leatherneck. “I guarantee you, if they come and attack us 100 times, they will be defeated.”

Lance Cpl. Jordan Cruz, 27, of Brownsville, Tex., said he hopes Hassam is right. Cruz said he’s been getting nervous messages from fellow Marines worried that the Taliban could regain ground that the Americans fought so hard in recent years to take back. He said one of his friends has a tattoo — stretching from his armpit to his hip bone — listing the names of fellow Marines killed in the war.

“After a lot of blood, a lot of resources and a lot of treasure, I don’t think they can afford to lose it,” Cruz said of the Afghans. “But it’s important for the [American] people to know we are going home. We are closing up, flying home and giving back to the Afghans this piece of their land.”