By some accounts, having states collaborate more closely with ICE could improve public safety. ICE has repeatedly urged police departments to take advantage of its Law Enforcement Support Center in Vermont, a 24-hour network that is distinct from the controversial 287(g) program.

With Congress mired in an increasingly angry debate over the 12 million illegal immigrants nationwide, police are left to contend with the fallout, from hard-core criminals who hide their identities to hard-working laborers who drive without licenses because they need to earn money to send home to their families.

The wildly disparate approaches of the two neighboring states — one that helps federal officials enforce immigration law, one that does not — illustrate how police are often caught in the middle between politics and public safety.

“We investigate not just traffic violators but also homicides, sexual assaults, drug trafficking, and any number of serious, violent crimes,’’ said David Procopio, Massachusetts State Police spokesman. “We cannot have some of these people fearing that they’re going to be deported if they talk to us.’’

Massachusetts troopers say they work with federal immigration agents on criminal cases, but otherwise focus on enforcing state laws.

But it is a practice that Governor Deval Patrick’s opponents in the governor’s race are urging Massachusetts to revive. The Patrick administration has staunchly opposed having state troopers enforce immigration laws, and shortly after he took office in 2007, the governor rescinded a pact by his predecessor, Mitt Romney, to assign 30 troopers to the so-called federal 287(g) program, which trains local police to enforce federal immigration law.

Rhode Island’s collaboration with federal immigration authorities is controversial; critics say the practice increases racial profiling and makes immigrants afraid to help police solve crimes.

“There are police chiefs throughout New England who hide from the issue . . . and I’m not hiding from it,’’ said Colonel Brendan P. Doherty, the towering commander of the Rhode Island State Police. “I would feel that I’m derelict in my duties to look the other way.’’

From Woonsocket to Westerly, the troopers patrolling the nation’s smallest state are reporting all illegal immigrants they encounter, even on routine stops such as speeding, to US Immigration and Customs Enforcement, known as ICE.

If the accident had happened 15 miles north in Massachusetts, the man would probably have been arrested for driving without a license, which carries a fine of up to $1,000 and 10 days in jail, then released pending an appearance in district court.

The man said he did not have a license, and under questioning, confessed that he was here illegally from Guatemala.

SCITUATE, R.I. — Rhode Island State Trooper Nuno Vasconcelos was patrolling Interstate 95 a few months ago when he came upon a two-car accident in heavy traffic. The trooper pulled up, stepped out of his cruiser, and asked one of the drivers for his license.

Bruce Foucart, special agent in charge of ICE in New England, said the center helps police verify the identities of immigrants who are suspected, arrested, or convicted of crimes, and aids ICE by informing them about people who are here illegally. The federal agency can then decide whether to detain an immigrant for deportation or release them pending a hearing in immigration court.

“Does that make for good public safety? Yes,’’ Foucart said. “How do you know who it is until you check him through the [center]?’’

Since Patrick rescinded Romney’s order, Massachusetts State Police communication with the Vermont center has plunged.

Last fiscal year, Massachusetts troopers checked the immigration status of 575 people with the federal support center in Vermont, an 87 percent drop from 4,461 checks in 2006.

Instead, Patrick had the Department of Correction screen inmates and report those here illegally to federal officials. Since 2007, the Department of Correction has turned over 524 inmates to federal officials.

In Rhode Island, a much smaller state, the State Police checks soared in the same time period, from 125 to 222.

Providence police started using the Vermont center daily in 2008 after an illegal immigrant with prior arrests and an outstanding deportation order kidnapped and raped a woman.

Patrick’s challengers for governor, Republican candidate Charles D. Baker and independent Timothy P. Cahill, called on Massachusetts to reinstate Romney’s plan. They raised the issue in May after an illegal immigrant from Mexico rear-ended a state representative’s car.

In Rhode Island, home to 1 million people and 30,000 illegal immigrants, the immigration debate has been far more incendiary.

In 2008, Governor Donald L. Carcieri, a Republican, issued an executive order mandating immigration checks on all new state workers and ordering State Police to assist federal immigration officials.

Sitting in his office in an old farmhouse off a country highway, Doherty said the State Police had collaborated with federal immigration officials before, but the relationship has become more formal in recent years. In 2007, he said, he trained all state troopers in how to deal with noncitizens because of widespread confusion and because Congress did not resolve the issue of illegal immigration. Troopers learned to notify consulates when noncitizens are arrested, how to recognize different forms of identification, and how to deal with different cultures.

In 2009, Doherty took it a step further and enrolled in the 287(g) program, which designated four troopers as immigration task force agents to assist in investigating drug and human trafficking and other crimes.

They also help regular troopers report illegal immigrants to ICE. Troopers say the issue typically comes up during criminal investigations or when motorists don’t have driver’s licenses, and police need to verify their identities with the center in Vermont.

Troopers also ask for passengers’ identification, which they say is standard policy. Passengers could decline, but most hand over their identification.

The Rhode Island ACLU and other critics say they are concerned that the State Police’s efforts are leading to racial profiling. Steven Brown, ACLU executive director, said police should focus on enforcing state law, not federal law, and questioned why they are singling out immigrants for enforcement.

For instance, he said, if they stop a young white man driving a Porsche for speeding, would they also check with the IRS to see whether he is paying his taxes?

“If everything’s in order, why are you pursing anything at all in the absence of the crime?’’ he asked.

Juan Garcia, a community advocate in Providence, said he regularly receives reports that State Police are appearing more frequently in mostly Latino neighborhoods.

“They’re stopping Guatemalans and Latinos,’’ he said. “We’ve seen a growth in this.’’

Separate ride-alongs with two troopers, Vasconcelos and Al Ruggiero, recently showed that troopers often have little time to react before deciding to pull someone over. Cars weave in and out of traffic or zip by at high speeds.

Both troopers said they run into illegal immigrants occasionally, perhaps once every few weeks or months.

“They’re treated with respect,’’ Ruggiero said. “We’re not out profiling.’’

Vasconcelos, the son of Cape Verdean immigrants who was born in Mozambique, said troopers feel compassion for undocumented immigrants who are just here to work; but, he said, troopers must enforce the law.

“To be honest, being an immigrant myself, I do feel, in a way, bad, but the law’s the law,’’ he said. “My job is to enforce the law. You try not to let personal emotions get involved.’’

Maria Sacchetti can be reached at msacchetti@globe.com. Follow her on Twitter at @mariasacchetti.

© Copyright 2010 Globe Newspaper Company.