A drone footage of the Niger ambush that killed four U.S. and five Nigerian soldiers that surfaced recently shows the service personnel desperately trying to escape and fighting for their lives after friendly Nigerien forces mistook them for the enemy.

The video shows the harrowing hours of troops holding off their enemy and waiting for rescue. It shows how the soldiers set up a defensive location on the edge of a marsh and wrote letters to their loved ones thinking they were going to die.

Pentagon released the video with explanatory narration and it contains more than 10 minutes of drone footage, animation and file tape that was not made public last week when the military released a portion of the final report on the October attack, the Guardian reported.

In a failed attempt to target a local ISIS leader, 46 U.S. and Nigerien troops were involved in the initial mission in the West African nation. The troop was attacked by more than 100 militants just outside the village of Tongo Tongo while the soldiers were heading back home after collecting intelligence from the site. Several members of the Nigerian troop escaped by a truck.

The video also shows four Nigerians and seven Americans fleeing on foot under heavy mortar and small arms fire. They crossed through a swamp on Oct 4 and they took cover at the edge of a clearing.

The video narration says, “They wrote short messages to loved ones on personal devices, believing they would soon be overrun.” 

GettyImages-146047693 Representational image of UN troops carrying on a stretcher the body of one of the seven UN peacekeepers from Niger who were killed in an ambush, at the airport in Abidjan, June 9, 2012. Photo: STR / Stringe/ Getty images

Two unarmed U.S. drones arrived overhead and established contact with the team about 20 minutes later. Two French Mirage aircraft also flew past at a low altitude to frighten the enemy after another seven minutes. Some of the militants can be seen running away quickly. A U.S. soldier can be seen waving the American flag to help the French helicopter that arrived three hours later spot them.

The team can be seen waiting at the clearing and two trucks moving into the frame in an overhead view. Suddenly, flashes of gunfire light up the screen. A Nigerian response force later arrived to provide assistance but ended up mistaking them for enemies. For almost a minute, they fired with automatic weapons, until they were able to confirm their identity. No one was injured in the brief gunfight.

The bodies of all U.S. soldiers except Sgt. La David Johnson, 25, of Miami Gardens, Florida, were traced on the same day. The U.S.  Africa  Command later launched a search operation to find him. Two days later, his body was found in a heavy bush where he had taken cover and fought in his final fight against the enemy.

The footage also shows Nigerian soldiers carrying his body and transferring it to a helicopter.

Though a number of failures were associated with the mission, none directly caused the enemy ambush, according to an investigation by the Pentagon, reported The Guardian.