Libyans gather amid debris in Tajoura, south of the Libyan capital, Tripoli, on June 15, following a reported airstrike by forces loyal to Khalifa Hifter. (Mahmud Turkia/AFP/Getty Images)

An American Air Force veteran who was accused of acting as a mercenary in Libya has been freed after a six-week detention, officials said Tuesday, in a murky episode that highlights the tangled nature of that country’s civil war.

Jamie Sponaugle, a 31-year-old Florida man, was piloting an aircraft near the Libyan capital of Tripoli on May 7 when his plane went down, according to officials and individuals familiar with the incident, who spoke on the condition of anonymity.

The Libyan National Army said it shot down the aircraft, which it said was a Mirage F1 combat jet piloted by a man The Washington Post is now identifying as Sponaugle, as it conducted bombing raids against LNA forces in the area. The Post withheld publication of Sponaugle’s detention at the request of U.S. officials who were working to secure his release.

The LNA is one of two factions locked in a years-long fight for control of Libyan territory and government institutions, a conflict that has plunged the country into a protracted limbo and erased much of the hope created by the 2011 revolution.

The apparent involvement of an American military veteran in a battle for Tripoli between the LNA and its rival, the U.N.-backed Government of National Accord, illustrates the complexity of a long-simmering conflict that has emerged as a major global proxy war involving illicit arms and dueling accusations of mercenary use.

It also draws attention to the shifting U.S. policy on Libya. While senior Trump administration officials have devoted limited time to Libya, the president appeared to upend years of steady support for the Tripoli-based GNA in April when he publicly praised Khalifa Hifter, the strongman who heads the rival LNA.

“We are always pleased to see Americans held captive overseas returned home to their friends and family,” Ambassador Robert O’Brien, President Trump’s envoy for hostage affairs, said in a phone interview. “We appreciate his captors’ decision to release him. We also thank the kingdom of Saudi Arabia for its role in resolving this case.”

Officials said that Sponaugle was flown on Tuesday to Saudi Arabia, where he was expected to meet with U.S. consular officials and undergo a medical and psychiatric examination.

According to an individual familiar with the case, Saudi Crown Prince Mohammed bin Salman took an interest in Sponaugle once Saudi officials learned he was being detained and asked subordinate officials to get involved. The Saudi government did not pay the LNA for his release, the individual said.

In remarks to the media the day after Sponaugle’s release, Maj. Gen. Ahmed al-Mismari, spokesman for the LNA, said the American had been held in the eastern city of Benghazi before being “extradited” to his home country.

Showing a video of Sponaugle pointing to locations on a map of western Libya, Mismari said he had “confessed” to conducting strikes on bridges and other infrastructure but had not carried out requested operations on more populated areas around Tripoli.

Stephen Payne, president of Linden Government Solutions, a firm the LNA has retained to lobby on its behalf in the United States, called on the United States to “seriously investigate reports of other American mercenaries fighting for the GNA, including other pilots, and, if proven true, demand their immediate return.”

The GNA did not respond to a request for comment.

Sponaugle, whose identity as an American has not been previously reported, became an enlisted airman in 2006 and worked as a mechanic, Air Force officials said. After leaving active duty in 2013, he served in the Florida Air National Guard until late 2016. His last job as an active-duty airman was airspace technician, and his last duty station was MacDill Air Force Base in Tampa.

He was not a pilot in the Air Force but earned a pilot’s license following his active duty service.

In images released by the LNA shortly after the incident, Sponaugle is seen bloodied and receiving medical treatment from LNA forces after his aircraft went down. Video that appeared on social media showed him identifying himself as a Portuguese national named Jimmy Rees and saying he was in Libya under a civilian contract focused on “destroying bridges and roads.”

Sponaugle did not say in that video that he worked for the GNA but named someone named “Hadi” as his chief Libyan contact. Senior GNA officials, including Deputy Prime Minister Ahmed Maiteeg, who was in Washington this month as part of a trip designed to drum up American support for his government, have denied that the GNA uses foreign pilots. A Western official with knowledge of Libya said that foreign instructors had long worked at Libya’s air academy, based in the city of Misrata.

Even after his release, U.S. officials do not have a clear understanding of what Sponaugle was doing in Libya. If Sponaugle was piloting a Mirage, a French-made fighter jet, as the LNA alleges, he is unlikely to have had the kind of combat training that military pilots typically undergo because he was not a pilot in the Air Force.

It’s not clear whether Sponaugle would have violated U.S. law by working for or fighting in Libya. Many countries, including the United States, employ foreign security contractors, who can play a variety of roles and are sometimes armed. The GNA and the LNA have repeatedly accused each other of using foreign fighters.

Ben Fishman, a senior fellow at the Washington Institute for Near East Policy who worked on Libya policy during the Obama administration, said the incident “demonstrates that the longer this phase of the conflict lasts, the . . . higher the risk will be of more foreigners getting involved.”

“It’s bad enough that there’s a clear flow of weapons and technology,” Fishman said. “Mercenaries or contractors from the region, Africa, or even the West would signal a new and dangerous form of escalation.”

Already the Libyan conflict involves a host of foreign actors. U.S. officials have said that the United Arab Emirates and Egypt have long provided support, including weaponry, to Hifter and the LNA, which have sought to depict themselves as the only force capable of defeating extremists in Libya. Turkey, meanwhile, is among the nations that have provided support to the GNA.

Just before he launched the Tripoli operation in April, the Saudi government offered to help Hifter fund the operation, the Wall Street Journal reported.

U.N. officials have sought for years to broker an end to the Libyan conflict in a peace process that has moved in fits and starts. While the feuding sides have at times seemed close to striking a deal, they now appear far apart as the Tripoli operation remains locked in what analysts say is an extended stalemate.

Initially, the State Department condemned Hifter’s offensive in pointed terms. Then, in a seeming about-face, the White House shortly afterward announced that Trump had held a call with Hifter. Describing the call, the White House highlighted Hifter’s efforts against extremists and did not address the ongoing battle for Tripoli, appearing to enhance the Libyan leader's stature on the world stage.

The LNA said following Sponaugle’s capture that he — at a moment when he was still being identified as Portuguese — was being treated humanely and in accordance with international law. But U.S. officials remained concerned about his welfare as they spent weeks in discussions with LNA officials. Sponaugle’s father declined to comment when reached at his home before his son’s release.

Update: This story was updated on June 26 to include statements from the LNA and its lobbying firm.

Lori Rozsa in Florida and John Hudson in Washington contributed to this report.