SOMERVILLE, Mass. (AP) -- Somerville's mayor says he will sign an executive order that bars city police from detaining people simply because they are suspected of living in the U.S. illegally.

Mayor Joseph Curtatone says he plans on signing the order Thursday.

Curtatone says city police will only hold someone for U.S. Immigration and Customs Enforcement if the agency has a criminal warrant or if there is a "legitimate law enforcement purpose" beyond immigration status.

Curtatone says it's the "morally responsible" thing to do and will strengthen families.

The mayor says the federal Secure Communities program has been a failure because more than half of those people deported from Massachusetts in the past two years had no criminal convictions, tearing their families apart and discouraging cooperation with police and the reporting of crimes.