ATLANTA — Seven law enforcement officers were shot — at least one of them fatally — in an extraordinary barrage of firepower after the authorities sought to serve a search warrant in South Carolina on Wednesday, officials said, transforming a residential subdivision into a tragic battleground.

The episode, punctuated by evacuations in a tactical vehicle and a protracted standoff between a barricaded suspect and the authorities, was among the American police shootings with the greatest bloodshed in recent years.

“They thought it was a random search warrant,” Sheriff Kenney Boone of Florence County, S.C., said at a news conference on Wednesday night, when he and other local officials appeared distraught. “But when they arrived, gunfire started.”

Chief Allen Heidler of the Florence Police Department praised the deceased officer, Terrence Carraway, as “the bravest police officer that I have ever known.” Officer Carraway had been a member of the police force in Florence for more than 30 years, officials said.