Elizabeth Police Director James Cosgrove will resign after an internal inquiry found he used racist and sexist slurs against his own staff, the city’s mayor said Tuesday.

Cosgrove had faced mounting pressure after state Attorney General Gurbir Grewal, New Jersey’s top law enforcement official, called for his resignation and installed a close aide as acting Union County prosecutor to enact an internal affairs overhaul at the city police department.

Mayor Chris Bollwage, who appointed Cosgrove to the job more than 20 years ago, announced the resignation after meeting with Grewal Tuesday afternoon. It was the first time he has addressed the accusations against Cosgrove publicly.

The mayor also announced he had asked Elizabeth Police Chief John Brennan to step aside while an unspecified complaint from a police officer is probed.

The allegations against Cosgrove were raised by Westfield attorney Josh McMahon, who represents a number of department employees in whistleblower suits. McMahon said staff reported that for years, Cosgrove had used the n-word to refer to African American employees and the c-word, an offensive term for female genitalia, to refer to women. After a two-month probe, the prosecutor’s office substantiated the complaint, according to a letter provided by McMahon.

But since Cosgrove is a civilian appointee and not a uniformed law enforcement officer, the only one who could fire him was his long-time political ally, Bollwage.

He will step down in two days, according to a statement released by Bollwage Tuesday afternoon:

"After meeting with the Attorney General today and discussing a path forward, I have accepted the resignation of Police Director James Cosgrove. Our conversation centered on changing personnel in the Internal Affairs Department, as only the Chief of the Police Department has that power. In addition, the whistle-blower complaint filed by an officer against Police Chief John Brennan was discussed. In order to truly change the culture of the Police Department, I am also calling upon Chief Brennan to step aside during this investigation.

"Prior to his departure, effective in two days, I have also asked Director Cosgrove to use that time and brief the City Attorney, William Holzapfel and the Business Administrator, Bridget Anderson, on current personnel and policy issues as it pertains to the police department as the City begins a search for a new Police Director.

“As Acting Prosecutor Jennifer Davenport proceeds with the investigation, I pledge our cooperation in ensuring the Police Department is sensitive to the needs of our residents.”

It is unclear what allegations have been brought against Brennan, who as police chief answered to Cosgrove. The city first disclosed that a complaint had been filed against Brennan April 22 in response to an inquiry from NJ Advance Media about Cosgrove’s employment status.

Cosgrove’s resignation marks a major change for the department he has led since 1998 – one that has seen its share of turmoil.

In 2016, the two police unions representing the city’s approximately 300 officers took ‘no confidence’ votes in Cosgrove’s leadership. In union documents, they described the department as being run by politics, favoritism and retaliation.

Now the Union County Prosecutor’s Office is conducting a review of the department’s workplace culture and hiring practices.

Community activist Salaam Ismial, who was among those to call for Cosgrove’s resignation, said the news Tuesday that he would step down made him both happy and sad.

“I’m happy this director is gone but I’m still sad about what’s left behind: the traces of racism in the department,” he said. “You have to change the culture.”

New Jersey’s fourth-largest city, Elizabeth is home to a majority latino population, as well as a significant number of African-American residents.

According to NJ Advance Media’s database the Force Report, police officers in Elizabeth reported using force on suspects at a rate higher than 424 of New Jersey’s police departments, including the state’s three larger cities: Newark, Jersey City and Paterson.

Black suspects were 71 percent more likely to have force used against them by city police than white residents, the data shows.

S.P. Sullivan may be reached at ssullivan@njadvancemedia.com. Follow him on Twitter.

Rebecca Everett may be reached at reverett@njadvancemedia.com. Follow her on Twitter @rebeccajeverett. Find NJ.com on Facebook.

Have a tip? Tell us. nj.com/tips

Get the latest updates right in your inbox. Subscribe to NJ.com’s newsletters.