31 Orlando police officers sued over their response to Pulse nightclub massacre that left 49 dead Police "arrested and/or detained as many non-injured victims as they could."

A city police officer acting as a security guard didn't do his job and more than two dozen of his colleagues failed in their duties or violated the civil rights of surviving victims after the 2016 Orlando, Florida, nightclub massacre, according to a new federal lawsuit.

The gunman, Omar Mateen, was shot dead by police after killing 49 people and wounding 58 at Pulse nightclub in what was then the deadliest mass shooting in modern U.S. history.

Orlando police officer Adam Gruler, according to court papers filed Thursday in U.S. District Court, "was at Pulse at all pertinent times and was charged with providing security to Pulse. Instead, he abandoned his post, thereby allowing [the] shooter to not only enter the club once to scout out the area and make sure nobody could stop him, but to then leave Pulse, retrieve his firearms, and return to execute his sinister plan to kill people."

The lawsuit also lists 30 unidentified Orlando police officers who the plaintiffs allege either remained outside the nightclub while the shooting occurred or held witnesses against their will after they fled the massacre. The city of Orlando is listed as an additional defendant.

"While people, unarmed, innocent were inside a club getting absolutely massacred by a crazed gunman there were a bunch of people ... with guns, with the training and capability to take that shooter out,” Solomon Radner, attorney for the plaintiffs in the case, told ABC News.

“Instead of doing their job, they worried about themselves, they stayed outside, they worried only about their own safety, knowing that people were literally getting mowed down by the dozens just a few feet away.”

In a joint statement, the city of Orlando and the Orlando Police Department said they have not seen the lawsuit, “nor have we been formally served with the lawsuit. We can't comment on the substance of the litigation.”

“Nearly two years after the horrific act of hate inside the Pulse nightclub, our community continues to mourn the 49 lives taken and provide support for all those impacted. On the morning of June 12, 2016, federal, state and local law enforcement officers and first responders put themselves in harm’s way to save as many lives as possible,” according to the statement.

“Our first responders are committed to the safety of this community, and they stand ready to protect and serve.”

The police union did not immediately respond to ABC News’ request for comment.

Gruler declined to comment Thursday, referring ABC News to the city and police department.

Mateen, a U.S. born citizen who had pledged his allegiance to the Islamic State terrorist organization in a 911 call he made from the nightclub, attacked the club June 12, 2016.

The police investigation showed that Mateen began the massacre around 2 a.m., but it wasn't until around 5 a.m. that Orlando police officers shot him to death after they used an armored truck to breach a wall.

Among the 34 plaintiffs in the lawsuit are the estates of six people who were killed in the shooting. Nine of the plaintiffs were detained or "arrested" by police as they ran out of the nightclub, Radner said.

"As the people were running out of the club, thinking that they were safe, the police were there waiting for them, and the police, essentially, for all intents and purposes, arrested every single victim there and held them for 10 to 12 hours," he added.

"Virtually every victim they could get their hands on who wasn't shot or dead, they basically arrested them. They were not free to leave, they were not free to call their loved ones, they were not even free to go to the bathroom or to get water."

The officers violated the Fourth Amendment right against unreasonable searches and seizures by detaining and holding the victims and witnesses against their will and confiscating the cellphones and vehicles of some of them, Radner said.

"The police are not allowed to detain you even if you are the victim of a terrible crime, even if they need to interview you,” Radner told ABC News. “You don't get to decide that the Fourth Amendment doesn't apply and to just go and arrest people. You don't get to do that and that's what they did.”

He added: "That made the trauma way worse for a lot of people because you can only imagine they just watched their loved ones get shot up, blood everywhere, bullets everywhere, guns everywhere.”

Gruler, who police determined fired “multiple rounds” toward Mateen, is the only officer named in the lawsuit. The 30 other officers listed as John Does have yet to be identified.

"Defendant Gruler, working in his official capacity as a law enforcement officer for the City of Orlando, was tasked with defending Pulse but abandoned his post," according to the lawsuit.

"The only time you can sue a municipality is if you can demonstrate that the only reason those officers engaged in that unlawful conduct, that unconstitutional conduct, is because of a specific policy, procedure, protocol or custom either written or unwritten of the city which allows, encourages, approves or authorizes that conduct," Radner told ABC News. "We certainly feel there's enough here that demonstrates deliberate indifference on the part of the city."

The lawsuit is asking for unspecified compensatory and punitive damages and attorney's fees.

"We are asking for compensation for the victims for what they went through at the hands of law enforcement," Radner said.