WASHINGTON — The artillery barrage was so intense that the American commandos dived into foxholes for protection, emerging covered in flying dirt and debris to fire back at a column of tanks advancing under the heavy shelling. It was the opening salvo in a nearly four-hour assault in February by around 500 pro-Syrian government forces — including Russian mercenaries — that threatened to inflame already-simmering tensions between Washington and Moscow.

In the end, 200 to 300 of the attacking fighters were killed. The others retreated under merciless airstrikes from the United States, returning later to retrieve their battlefield dead. None of the Americans at the small outpost in eastern Syria — about 40 by the end of the firefight — were harmed.

The details of the Feb. 7 firefight were gleaned from interviews and documents newly obtained by The New York Times. They provide the Pentagon’s first public on-the-ground accounting of one of the single bloodiest battles the American military has faced in Syria since deploying to fight the Islamic State.

The firefight was described by the Pentagon as an act of self-defense against a unit of pro-Syrian government forces. In interviews, United States military officials said they had watched — with dread — hundreds of approaching rival troops, vehicles and artillery pieces in the week leading up to the attack.