Black Lives Matter activist DeRay Mckesson sued the city of Baton Rouge on Thursday over his arrest last month at a protest of a black man fatally shot during a struggle with two white police officers.

Mckesson was among nearly 200 protesters arrested in Baton Rouge following the July 5 shooting death of 37-year-old Alton Sterling.

A class-action lawsuit filed in federal court on behalf of Mckesson and two other arrested protesters accuses the city and police officials of violating their civil rights and using excessive force. The suit said police responded in a "militarized and aggressive manner," advancing against protesters while wearing military gear and gas masks and brandishing assault weapons alongside armored vehicles. Officers threatened peaceful protesters by pointing their weapons directly at them, it said.

"Defendants used excessive force in attacking, battering, beating, and assaulting plaintiffs and class members without provocation or the need for defense," according to the suit.

Sterling's death was captured on cellphone video and circulated widely on the internet. His death, along with another fatal police shooting in Minnesota, sparked widespread protests. Then the fatal shooting of five police officers in Dallas by a black sniper heightened tensions even more.

Mckesson, of Baltimore, was arrested July 9 near police headquarters on a charge of obstructing a highway. District Attorney Hillar Moore announced that Mckesson is one of roughly 100 arrested protesters who will not be prosecuted by his office.

The governor and the Baton Rouge police chief have defended the response to the protests, with the chief saying there were credible threats against law enforcement. Authorities said they found out one such plot after they arrested three suspects in the burglary of eight guns from a pawn shop. Then, on July 17, a lone gunman shot and killed three law enforcement officers and wounded three others outside a Baton Rouge convenience store.

In addition to the city and East Baton Rouge Parish, the suit names the mayor, the head of the state police, the local police chief and the sheriff as defendants.

The American Civil Liberties Union of Louisiana and other groups also filed a lawsuit last month over the treatment of protesters by police.