An undated photograph obtained Friday shows Laurent Lassimouillas, left, and Patrick Picque posing at an undisclosed location. The two were kidnapped May 1 in Benin. (AFP/Getty Images)

French forces have freed four hostages — including an American citizen — in the West African nation of Burkina Faso, where militant Islamist violence is surging, the French government said Friday.

The military raid resulted in the deaths of two French soldiers late Thursday during a confrontation in the country’s north. That stretch of largely ungoverned land has become a hotbed of extremism in recent years as insurgents spilled over the border from Mali.

France ordered the special operation to save two French tourists, who vanished last week in neighboring Benin’s Pendjari National Park. Authorities later found the body of their guide, officials said.

The raid also released the American and a South Korean citizen, whose identities have not been made public.

French President Emmanuel Macron “bows with emotion and gravity at the sacrifice of our two soldiers, who gave their lives to save those of our fellow citizens,” the French government said in a Friday statement, thanking Beninese and Burkinabe authorities for their “perfect cooperation.”

In a statement released on Twitter, French Minister of the Armed Forces Florence Parly welcomed the “valuable support of our American allies” in the operation.

The French Navy tweeted photos Friday of the soldiers who died and said the military was “mourning” with their families. The images depict both men smiling in camouflage gear.

The U.S. State Department confirmed Friday that an American citizen was among those released but would not comment further, citing “privacy considerations.”

Burkina Faso, a former French colony where more than three-quarters of the people work in farming, was recently considered to be a safe place, with sprawling parks, an international arts and crafts fair and a biennial film festival.

Now a stubborn insurgency is threatening that peace. Attacks in Burkina Faso have quadrupled over the past two years, according to the Africa Center for Strategic Studies in Washington.

Islamic State leader Abu Bakr al-Baghdadi made note of Burkina Faso when he resurfaced in a video earlier this month after a five-year absence. In the video, he congratulated the groups operating in Burkina Faso for pledging allegiance to the Islamic State, describing that they would take “revenge for their brothers in Iraq and Syria.”

French officials warn tourists to stay away from the borders. Terrorist groups see capturing foreign visitors as opportunities to bag ransom payments.

“Kidnapping presents an opportunity to either generate income for these groups or, if they decide to execute hostages, raise their international profile,” said Judd Devermont, who studies the threat at the Center for Strategic and International Studies in Washington.

Nearby Mali and Niger, where five militant Islamist groups operate, have grappled with extremism for years.

Burkina Faso is no longer safe from the bloodshed that afflicts its north and east. About 70,000 people have fled their homes since the year started, according to U.N. estimates.

France has the largest foreign military presence in the country, part of a contingent of 4,500 troops working to thwart terrorism in West Africa. The United States has also conducted Special Operations in Burkina Faso and trained West African soldiers there.