An Iraqi refugee now charged with attempted murder of a Colorado police officer was actually in ICE custody in 2016 but was ordered released thanks to a court decision that ruled his previous convictions for assault and a host of other crimes weren’t serious enough to deport him.

Authorities say Karrar Noaman al Khammasi, charged last week after what police say was a shootout with Colorado Springs officers, could have been ousted from the country during the Obama administration, but for a series of judges’ rulings that set him free to continue a five-year-long crime spree.

His arrest also raises tough questions about the refugee program at a time when the Trump administration is eyeing major new constraints on the number of people let in each year.

Mr. Khammasi was admitted to the U.S. in 2012 as a refugee from Iraq, according to a Homeland Security official.