Mayor-elect Martin J. Walsh said today that he wants Boston to pull out of the Secure Communities program, a controversial federal initiative designed to identify illegal immigrants.

The program allows the Department of Homeland Security to access fingerprints taken by local police, which the federal officials can check against federal immigration databases. Those who are in the country illegally can then be deported.

Walsh said he, like immigration activists, believes the program nets too many illegal immigrants detained for nonviolent offenses, such as driving infractions.

Advertisement - Continue Reading Below

“If we can get around it, I won’t” continue to enforce the program in Boston, Walsh told reporters at a Thanksgiving dinner for immigrants at the State House. “People that are getting pulled over — I don’t think that necessarily we have to bring in immigration for that.”

The federal government says it prioritizes for deportation those who pose the greatest threat to public safety, based on their criminal histories.

Under Mayor Thomas M. Menino, Boston piloted Secure Communities in 2006, and the program was expanded nationally in 2008 with the support of President Obama.

It is not clear whether Walsh would have the unilateral authority to end Boston’s participation in the program since it is a federal initiative. Last year, federal officials expanded the program in Massachusetts, despite long-standing opposition from Governor Deval Patrick.

Walsh, the son of Irish immigrants, said he supported state legislation known as the Trust Act that would limit Massachusetts’ participation in the program. Governor Jerry Brown of California signed a version of the bill into law in his state last month.