JUNEAU, Alaska — The American Civil Liberties Union of Alaska is suing a city north of Anchorage and members of its police force, alleging officers wrongfully detained a Peruvian man over his immigration status after his attempt to break up a bar fight left him beaten and bloodied.

The lawsuit against the city of Palmer challenges the authority of local law enforcement to make civil immigration arrests, ACLU-Alaska attorney Tara Rich said. Local police departments lack authority under state or federal law for such arrests, the lawsuit states.

Michael Gatti, an attorney who represents Palmer, said the city has received a copy of the complaint, and it is being reviewed.

The case, filed on behalf of Alex Caceda (kuh-SAY-duh) on Thursday, seeks unspecified damages. Caceda’s full name, according to the filing, is Andres Alexander Caceda-Mantilla.

According to the lawsuit, Caceda was helping provide security at a bar in Palmer, about 40 miles north of Anchorage, when a fight broke out last August. He tried to help a female bartender who was being attacked and was himself punched and kicked by three men who left him bleeding from his head and face, the lawsuit says.

When police arrived, the lawsuit says the three men were handcuffed and officer Kristi Muilenburg approached Caceda and the bartender about the incident. It says Muilenburg asked Caceda if he was from Alaska and if he had an Alaska driver’s license. She asked a dispatcher to contact federal immigration officials after Caceda said he was from Peru and produced his passport as ID, the lawsuit claims.

According to ACLU-Alaska, the U.S. Immigration and Customs Enforcement agency suggested detaining Caceda. The lawsuit alleges Muilenburg told Caceda it was “a federal thing” when he asked why he was being arrested.

Caceda is married to a U.S. citizen but “did not have legal immigration status at the time of this incident,” the lawsuit states. He was held four nights in area jails before being released. Caceda told federal officials he would apply for a visa sponsored by his wife that would make him eligible to seek status as a permanent resident, according to the lawsuit.

In other parts of the country, the ACLU and other groups have challenged local agencies that cooperate with federal immigration authorities in ways they deem inappropriate.

Under President Donald Trump, the U.S. Immigration and Customs Enforcement agency has adopted tougher policies for who is targeted for deportation than was the case under the Obama administration.

Defendants in the Alaska case are the city of Palmer; Muilenburg, who is listed by the police department’s website as a detective; patrol Sgt. Jamie Hammons, police officer Daniel Potter, and dispatcher Hilary Schwaderer. The lawsuit spells Muilenburg as Muilenberg.

The injuries to Caceda’s head and face required eight stitches. The men who hit Caceda were not prosecuted, the lawsuit said.