State law enforcement officials are accusing sheriffs in two New Jersey counties of failing to inform the state’s attorney general that they are helping federal immigration authorities capture and deport undocumented immigrants.

In a pair of sternly worded letters to elected sheriffs in Monmouth and Cape May counties, top officials in state Attorney General Gurbir Grewal’s office say the county sheriffs violated a directive Grewal issued earlier this year seeking to limit cooperation between New Jersey cops and Immigration and Customs Enforcement.

The letters were sent to Monmouth County Sheriff Shaun Golden and Cape May Sheriff Robert Nolan, both Republicans.

They highlight the tension between federal authorities in President Donald Trump’s administration who have sought to ramp up deportation of unauthorized residents, New Jersey law enforcement officials who want no part of the crackdown and county and local police who remain divided over the issue.

The letters, sent to the sheriffs by Division of Criminal Justice Director Veronica Allende on Saturday and Monday and obtained by NJ Advance Media, note that the two counties recently renewed agreements with ICE that “essentially deputize” sheriff’s officers as federal immigration agents.

Grewal — who was appointed by Democratic Gov. Phil Murphy and has sparred with the Trump administration over immigration, the environment and consumer protection, among other issues — announced last year he was overhauling the state’s policies for working with federal immigration officials.

The attorney general’s “Immigrant Trust Directive,” which went into effect in March, seeks to limit police cooperation with ICE to criminal matters, rather than civil immigration proceedings.

Critics, including some county sheriffs, said the directive turned New Jersey into a “sanctuary state." Grewal countered that local police officers are not immigration agents and that undocumented immigrants were less likely to report crimes or cooperate as witnesses if they could not easily distinguish between the two.

At the time, sheriff’s offices in three New Jersey counties — Cape May, Monmouth and Salem — still had existing agreements with ICE under a program dubbed “287g," which allows state and local law enforcement to “act as a force multiplier” for ICE. Several counties had earlier done away with the agreements, which in New Jersey mainly applied to officers in county jails.

Salem County is no longer listed among its participants.

Messages left with sheriff’s offices in Cape May and Monmouth counties seeking comment were not immediately returned Monday evening. In May, a spokeswoman told The Record newspaper that the Monmouth sheriff’s office “never wants to be faced with a situation where a dangerous, undocumented alien could be released from jail and into a community in Monmouth County.”

Jurisdictions in 21 states take part in the program, which has expanded in recent years, according to ICE. Federal officials say the program “allows ICE to actively engage criminal alien offenders while incarcerated in a secure and controlled environment.”

Grewal’s directive did not explicitly prohibit such agreements, but ordered any agency seeking to renew or enter into such a deal to seek permission from his office, which oversees all law enforcement agencies in New Jersey.

In the letters, Allende wrote that her office had received no notification that Cape May and Monmouth had renewed their ICE deals. She first learned of the deals Friday when she was “contacted by a reporter” about the renewals, Allende wrote.

“The fact that no one in your office ever notified the Attorney General’s Office (of the renewal) suggests that you deliberately declined to disclose this information over the past four months,” each letters state.

Allende gave the sheriffs an August 6 deadline to provide more information about the agreement, after which Grewal would issue another directive banning officers in the two counties from working with ICE. The letters leave room for the deals to remain in place if the attorney general finds they serve "a valid law enforcement purpose.”

S.P. Sullivan may be reached at ssullivan@njadvancemedia.com. Follow him on Twitter. 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.