PHOENIX — Two advocacy groups alleged in a lawsuit Tuesday that police in Phoenix violated the free-speech rights of protesters outside a rally by President Donald Trump by firing tear gas as they were about to confront Trump supporters.

The excessive force lawsuit against the Phoenix Police Department says police didn't try to remove a few problematic anti-Trump protesters and instead acted violently toward a large number of peaceful demonstrators.

It also says officers deliberately targeted anti-Trump protesters and showed a preference toward Trump supporters.

The police agency "silenced anti-Trump protesters at the precise moment that they sought to have their opinions heard by the intended audience — President Trump and his supporters as they left the Convention Center," the lawsuit says.

Police spokeswoman Sgt. Mercedes Fortune declined to comment on the lawsuit.

The protest was held a year ago at a rally where Trump hinted he would pardon former Maricopa County Sheriff Joe Arpaio, a Trump ally.

Arpaio had been convicted of criminal contempt of court for intentionally ignoring a judge's order to stop his traffic patrols that targeted immigrants.

Days later, the president pardoned Arpaio.

The disturbance on the downtown streets didn't start until after Trump's speech inside the Convention Center had ended.

It turned unruly as officers fired pepper spray and tear gas at crowds after the police agency said someone apparently lobbed rocks and bottles at officers.

It was Trump's first political rally after he made statements equally blaming white supremacists and counter-protesters for violent clashes in Charlottesville, Virginia.

The two advocacy groups, Puente and Poder In Action, alleged in their lawsuit that police didn't formally announce to the protesters that they should disperse from the area until about a half-hour after officers began to use pepper spray, tear gas and other measures.

Puente advocates on behalf of immigrants, while Poder in Action has organized protests to raise awareness on issues affecting black, Latino and immigrant communities. Four anti-Trump protesters also joined in on the lawsuit.

Those who filed the lawsuit are seeking unspecified damages and a court order restraining Phoenix officers from disrupting people's free-speech rights in the future.

The lawsuit notes that some anti-Trump protesters kicked tear gas containers away from their fellow demonstrators, but the overwhelming majority of the demonstrators acted peacefully.