New Jersey Attorney General Gurbir Grewal on Friday took the extraordinary step of installing one of his top aides as acting Union County prosecutor and urging the longtime head of the county’s largest city police department to resign amid a scandal over racist and sexist slurs.

The announcement came days after NJ Advance Media reported an internal investigation substantiated claims against Elizabeth Police Director James Cosgrove brought by several whistleblowers. Documents obtained by the news organization show Cosgrove was accused of using the N-word and C-word to refer to black and female employees.

In a statement, Grewal said a two-month inquiry found Cosgrove had used “racist and misogynistic slurs” against members of his own staff “over the course of many years.”

“One of the core responsibilities of an effective law enforcement leader is to maintain the trust of the community he or she serves,” Grewal said. “Director Cosgrove has violated that trust and, in doing so, undermined confidence in our system of justice.”

The attorney general said Cosgrove “should resign his position immediately.”

Cosgrove, who has served as civilian police director for more than two decades, has remained silent on the accusations and could not be reached Friday. A spokeswoman for Elizabeth Mayor Chris Bollwage, who has the authority to fire Cosgrove, did not return a request for comment.

In the meantime, Grewal also installed First Assistant Attorney General Jennifer Davenport as acting prosecutor in order to make sure the county prosecutor’s office “exercises appropriate oversight of the Elizabeth Police Department and works to rebuild trust with the community and external stakeholders.”

A spokeswoman for Grewal declined to elaborate on why he was removing the current acting prosecutor, Michael Monahan.

Monahan was named acting prosecutor in January 2018 after several years working in the state Division of Criminal Justice, which is under the attorney general. Grewal’s spokeswoman, Sharon Lauchaire, said Monahan would be returning to a position there.

Josh McMahon, a Westfield attorney who said he represents multiple whistleblowers in the department, said he was “grateful” to the attorney general for taking a stand “against racism and misogyny in law enforcement.”

This is not the first time Cosgrove, a former Newark police officer who has overseen the department since 1998, has come under scrutiny.

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.

The attorney general’s action came amid mounting pressure for city, county and state officials to intervene in the department, which serves a diverse population in New Jersey’s fourth-largest city.

The New Jersey chapter of the American Civil Liberties Union in separate letters to Grewal and Bollwage this week called for Cosgrove’s removal and a sweeping audit of the department’s practices.

The attorney general on Friday said his Office of Public Integrity and Accountability would help Davenport conduct such a review, examining “workplace culture, including its hiring and promotional practices.”

The fallout of the scandal could linger over the department for years to come and will likely lead to civil suits and other trouble.

Earlier this week, McMahon wrote a letter to Monahan claiming that Cosgrove was retaliating against employees and had a history of sexual harassment and interference in internal affairs probes. The letter claimed Cosgrove had threatened to “take an ‘axe’ to the ‘head’ of the person(s) that began this investigation.”

The attorney also accused Cosgrove of spying on the political opponents of Bollwage, who has served as the city’s mayor since 1992.

“Unfortunately, Chris Bollwage seems to be the only politician in America who doesn’t realize that protecting a racist, sexist police director is simply unacceptable," McMahon told NJ Advance Media on Friday. “The mayor must fire Cosgrove immediately.”

Davenport will remain in her current job as first assistant attorney general, where she serves in Grewal’s executive leadership team.

Grewal also named one of his special assistants, Joseph Walsh, to serve as counsel for Davenport in her role as acting county prosecutor. Walsh, who was a police officer for 15 years before becoming a prosecutor, will take over the internal affairs functions of the Elizabeth Police Department, Grewal said.

A spokesman for the Union County Prosecutor’s Office declined to comment on the shakeup.

Staff writers Rebecca Everett and Sophie Nieto-Munoz contributed to this report.

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

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