Former sergeants union boss Ed Mullins defended his tweets calling city officials a "bitch" and "first class whore" on Monday, claiming that inflammatory comments were necessary to protect the safety of NYPD members.

"Police officers across the city were being assaulted, pelted with bottles, rocks, Molotov cocktails," Mullins said. "Those comments were made because they were soundbites. They drew attention to the harm that was being caused to the men and women of the NYPD."

The defiant testimony came during a department trial concerning two of Mullins' profane tweets. In the first, he labeled former Health Commissioner Dr. Oxiris Barbot a “bitch” in for reportedly blowing off an NYPD request for more masks at the start of the pandemic.

A few months later, Mullins derided Bronx Councilman Ritchie Torres as a “first class whore” over his suggestion that the NYPD was holding a work slowdown. Torres has since become the first openly gay Black member of Congress.

Prosecutors with the Civilian Complaint Review Board accused Mullins of "homophobic and misogynistic" statements that undermined the integrity of the department — arguing that he should be terminated for violating a Patrol Guide ban on discourteous statements.

“To have not come out and said anything would’ve been irresponsible of me,” replied Mullins, who walked into the small trial room with a briefcase and no face-covering, before later putting on a mask.

The trial comes weeks after Mullins stepped down as president of the Sergeants Benevolent Association, a role he has held since 2002, following a federal raid on his home and office. He is believed to be facing investigation for misusing union funds.

Mullins, who is still receiving an NYPD paycheck, has also announced his retirement from the department, triggering a 30-day window to square away any misconduct charges. A guilty verdict in the administrative trial into his tweets could leave Mullins without overtime or vacation pay that he’s accrued since joining the NYPD in 1982.

It's the first time that the Civilian Complaint Review Board has investigated a member of the NYPD over Twitter posts, according to a spokesperson for the independent watchdog agency.

During the two-hour trial on Monday, an attorney for Mullins, Hugo Ortega, invoked the specter of “political correctness,” while accusing the CCRB of stifling the free speech rights of union representatives. “The test is not whether someone is offended,” Ortega said.

Mullins is also facing a separate department investigation for tweeting a police report documenting the arrest of Chiara de Blasio, the mayor’s daughter, that included personal details, including her address and license plate information.

In both cases, Commissioner Dermot Shea will have final say over whether Mullins faces discipline. Those decisions are expected to come as early as next week.

Mullins declined to comment as he left police headquarters on Monday.