The president said it worked. The nation's top immigration agent said it worked. Even the inspector general said it worked. So why did the Obama administration kill a government program that did exactly what Congress intended by identifying and deporting illegal immigrants?

"It worked! It worked, I think, a little too well in terms of broadly identifying individuals that had been arrested and charged with crimes," said Julie Myers-Wood, who directed the Immigration and Customs Enforcement agency from 2005-2008.

At issue is an ICE program known as Secure Communities. Launched after the 9/11 attacks under the Patriot Act, it required immigration agents to have access to the fingerprints and criminal history of any immigrant booked in jail. That requirement came after studies showed immigration agents failed to identify 86 percent of all illegal immigrants released from jail.

Secure Communities cost more than $1 billion, and in 2012, then-ICE Director John Morton called it "the future of immigration enforcement." That same year, the Department of Homeland Security inspector general called Secure Communities a success, "effectively identifying criminal aliens ... with little or no cost" to local jurisdictions.

But to critics, the program cast too wide a net. In large, Democratically controlled cities like Chicago, San Francisco and Los Angeles, politicians said the program deported too many immigrants guilty of minor crimes, like traffic violations and non-violent offenses like theft and burglary. In response, some 200 cities created "sanctuary" laws to shield immigrants by prohibiting local police from cooperating when ICE sought to pick up an inmate.

Chris Newman, with the National Day Laborer Organizing Network, told the Huffington Post last year, "The tide has turned against the program, and I think there is now consensus that the program needs to be shut down completely." Fred Tsao, of the Illinois Coalition for Immigrant and Refugee Rights, added, "The whole machinery is just so flawed. If the focus really is on people who have committed serious crimes and have been convicted of those offenses, then you don't try to catch people when they've first been arrested, in many cases before they've even had a bond set for them."

Amid the pressure, DHS ended the program last year, replacing it with a narrower version called the Priority Enforcement Program, which targets only those held on certain offenses.

But many argue that Secure Communities worked -- and that sanctuary laws have gone too far, exempting not only drunk drivers and thieves but child molesters and killers, leaving the system paralyzed and the public at risk.

Those concerns were renewed earlier this month after an illegal immigrant released by the sheriff's department in one such city, San Francisco, was arrested for the murder of a woman along a city pier.

"It's not fair for cities to have choices like this. However, DHS and ICE have got to work with the realities that are out there," said Wood. "Until Congress changes the law or until there is a little action against those entities, I think it's very smart for DHS and ICE to try to find a way to come to common ground."

Officials created Secure Communities when studies revealed one out of six illegal immigrants released from jail were re-arrested within three years, according to the Congressional Research Service. A more recent study by Jessica Vaughan at the Center for Immigration Studies found, of 8,000 criminal aliens released by sanctuary cities in 2014, almost 2,000 were arrested again within eight months on charges including domestic violence and murder.

The illegal immigrant population of 11.7 million represents just 3.6 percent of the U.S. population. But according to the U.S. Sentencing Commission, illegal immigrants represent 12 percent of murder sentences, 20 percent of kidnapping sentences and 16 percent of drug trafficking sentences.

While some sheriffs support and others quietly agreed to the sanctuary restrictions imposed by lawmakers, Fresno County, Calif., Sheriff Margaret Mims has not. Instead of following the state law -- which limits communication between jail deputies and ICE -- Mims installed two ICE agents in the Fresno County jail.

In the past, ICE relied on deputies to notify them whenever a "person of interest" was scheduled for release. Mims believed that system made it possible for a dangerous offender to slip through the cracks. Under the new system, ICE agents have access to the inmates for interviews and can see their entire criminal history before making a decision on whether to deport them or not. In the last three weeks, Fresno County deported 23 illegal immigrants because of the program, the only one of its kind in the U.S.

William La Jeunesse joined FOX News Channel (FNC) in March 1998 and currently serves as a Los Angeles-based correspondent.