North Carolina Gov. Roy Cooper, a Democrat, on Wednesday vetoed a bill that would have required sheriffs in the state to work closely with federal immigration officials seeking to identify undocumented immigrants.

HB 370 cleared the state Senate in June, and the state House of Representatives passed the bill on Tuesday. Among other things, the measure would have directed authorities to determine the legal status of anyone taken into custody for a criminal offense. If a prisoner’s citizenship or legal status could not be determined, authorities would be required to tell Immigration and Customs Enforcement or the Department of Homeland Security.

Under the bill, state authorities also would have been required to comply with ICE and DHS requests to interview prisoners. Sheriffs or police officers who failed to do so could have been removed from office.

Cooper on Wednesday called the legislation “unconstitutional” and evidence of “partisan political pandering.”

“This bill, in addition to being unconstitutional, weakens law enforcement in North Carolina by mandating sheriffs to do the job of federal agents, using local resources that could hurt their ability to protect their counties,” Cooper said in a statement posted to his Twitter account.