Three U.S. Army Special Forces soldiers were killed and two others were wounded Wednesday in an ambush in the west African country of Niger.

Of the two Green Berets wounded, “both are expected to pull through,” a U.S. official with direct knowledge of the attack told Fox News.

One of the wounded had “life-threatening” injuries at one time, but has since stabilized. The other had serious injuries.

The squad of between eight and 10 soldiers was amb.ushed in a rural area about 125 miles north of Niger’s capital, Niamey, near the border with Mali, the U.S. official said.

"It was a routine patrol in order to train the Nigerien forces," the official said. "It was not a raid."

It was unclear which terrorist group conducted the attack. In addition to Al Qaeda in the Islamic Maghreb (AQIM), other groups affiliated with ISIS are active in the area.

It is not clear if any U.S. aircraft were overhead at the time. Niger does not allow armed drones to take off from a base shared with the United States.

White House press secretary Sarah Sanders said President Trump had been briefed on the ambush by Chief of Staff John Kelly.

Africa Command says the U.S. forces are in Niger to provide training and security assistance to the Nigerien Armed Forces in their efforts against violent extremists.

Niger, a former French colony, is one of the poorest nations in the world. In April, the State Department issued a travel warning advising American citizens against visiting the landlocked country's border regions, including the area where the ambush took place.

"Due to security concerns and travel restrictions, the U.S. Embassy’s ability to assist U.S. citizens in remote and rural areas is very limited," read the statement.

"There is a high threat of kidnapping by terrorist groups including AQIM, which has kidnapped Westerners and threatened U.S. citizens in Niger," the State Department’s travel warning added.

In 2013, AQIM was linked to a hostage crisis at a desert oil complex in Algeria, near the Libyan border. Hundreds of people, mostly Algerians, were takem hostage. The Algerian army responded by increasing its presence in the area.

The website of the British government includes a list of terror incidents known to have taken place in Niger in recent years. These events have included:

-- March 6, 2017: A terrorist attack at Wanzarbé, southwest Niger, resulted in the deaths of five Nigerien soldiers.

-- Feb. 22, 2017: An attack on the Nigerien army in the Tillabéri region resulted in the deaths of 16 soldiers and injuries to 17.

-- Oct. 17, 2016: A high-security prison near the border between Niger and Mali was attacked.

-- Oct. 14, 2016: An American aid worker was kidnapped in Abalak, a province of the region of Tahoua 350 km northeast of Niamey.

-- Oct. 6, 2016: An attack by violent extremists on a Malian refugee camp in Tazalit, near the Malian border, resulted in the deaths of 22 Nigerien soldiers

-- June 2016: An attack by Boko Haram on the town of Bosso left 32 dead and many more injured or displaced.

-- Feb. 8, 2015: An explosion in the town of Diffa resulted in several deaths and injuries.

-- Feb. 6, 2015: Nigerien and Chadian military forces were attacked by Boko Haram in the towns of Bosso and Diffa.

The Associated Press contributed to this report.