RALEIGH, N.C. — North Carolina Governor Roy Cooper vetoed a bill Wednesday that would have required county sheriff departments to hold undocumented immigrants for Immigration and Customs Enforcement. 

The House voted 62-53 on Tuesday to accept Senate changes to House Bill 370. The bill was created in responds to a handful of dissenting sheriffs refusing to cooperate with ICE officials and the detainers it issues. Mecklenburg County Sheriff Garry McFadden was among those sheriffs.

"I was elected with a clear mandate to stop honoring voluntary ICE detainers and to end the 287(g) program," McFadden said in a released statement. "HB370 is unconstitutional on its face-as it suggests that a state magistrate judge can rule on immigration matters like the legitimacy of an ICE detainer."

RELATED: Immigration bill requiring sheriffs to corporate with ICE detainers heads to Gov. Cooper

The governor, who has previously opposed HB370, was expected to veto the bill Wednesday.

"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. "To elevate their partisan political pandering, the legislature has made a sheriff’s violation of this new immigration duty as the only specifically named duty violation that can result in a sheriff’s removal from office."

RELATED: Battle brewing between ICE, Mecklenburg County sheriff

McFadden campaigned on a promise to eliminate the voluntary immigration program, which helped ICE keep illegal immigrants detained.

“287(g) is off the table,” he said in June after federal officials accused him of releasing dangerous criminals. “You bring me a federal warrant.”

In May, Luis Pineda-Anchecta was arrested for multiple charges including kidnapping, strangulation, and assault on a female regarding a domestic violence assault. On June 1, he paid bond and was released from jail. The next day he was arrested by ICE officials, who released a statementing saying:

“U.S. Immigration and Customs Enforcement arrested unlawfully present Honduran national Luis Pineda-Anchecta during a targeted enforcement operation in Charlotte June 2 following his release from local criminal custody after the Mecklenburg County Sheriff’s Office refused to honor an ICE detainer, nor even notify ICE of his release, and instead released an unlawfully present foreign national facing serious criminal charges onto the streets of Charlotte. Mr. Pineda-Anchecta now faces federal felony prosecution for illegally reentering the U.S. after deportation. After the resolution of that federal prosecution he is subject to removal again to Honduras.” 

RELATED: Suspect from 9-hour SWAT standoff released from custody Saturday night, arrested by ICE team Sunday

At the time, McFadden said the federal government wrongfully blamed him for the Pineda-Anchecta's release.

"My decision that MCSO will no longer honor voluntary ICE administrative detainers is not the sole reason for Pineda-Ancheta’s releases," McFadden said.

McFadden went on to say Pineda-Ancheta had fulfilled his court-ordered terms and conditions of release. The statement said that MCSO is required by law to release individuals from custody after satisfying bond and court-ordered conditions of release. 

"Based upon Pineda-Ancheta’s previous deportation, ICE could have but did not seek a criminal arrest warrant for Illegal Re-Entry," McFadden said.

The sheriff said the only way he will keep an illegal immigrant in jail who has met all of his or her release requirements is if ICE gets a federal warrant signed by a judge. 

McFadden released a statement in support of Governor Cooper's veto, calling the bill unconstitutional and saying it 'would steal the authority' of sheriffs to make decisions they are elected to make.

His statement reads, in part, "My goal remains to work with all law enforcement agencies, state and federal prosecutors, and the judiciary, to implement plans and programs to keep the community safe.  If the legislature overrides the Governor’s veto and HB370 becomes the law, I will, of course, direct the Mecklenburg County Sheriff’s Office to abide by it as we do all laws.  But for the people of Mecklenburg County I sincerely hope that day never comes."

In response to the bill's veto, an ICE representative also released a statement, saying:

"In general, when law enforcement agencies fail to honor immigration detainers and release serious criminal offenders onto the streets, it undermines ICE’s ability to protect public safety. Non-cooperation policies protect criminals, and only criminals, as 100 percent of persons subject to an ICE detainer are in a local jail pursuant to their criminal arrest, not their immigration status."