An Iraqi immigrant who allegedly shot a Colorado cop Thursday during a shootout has been involved in a string of crimes for the past five years — yet avoided being deported, a report said.

Karrar Al Khammasi, 31, missed his Friday court appearance after he was hospitalized following a shootout with officers in Colorado Springs. Al Khammasi is accused of shooting Colorado Springs Officer Cem Duzel in the head early Thursday morning, leaving the cop in critical but stable condition as of Saturday.

Before Thursday’s shooting, Al Khammasi was known to immigration enforcement officials due to his nine prior contacts with police, the Colorado Springs Gazette reported.

His first incident was in 2013, when he was charged with drunken driving. About a month later, Al Khammasi was charged with criminal extortion where investigators believe he threatened a man and his family and set a car on fire.

COLORADO SPRINGS POLICE OFFICER CRITICALLY INJURED IN SHOOTING, GUNMAN ALSO SHOT

Court records stated Al Khammasi was sentenced to two years of probation after pleading guilty to first-degree trespassing of a dwelling in 2014. Al Khammasi was on an immigration hold that day.

His criminal history continued this year when Al Khammasi was arrested in January for allegedly possessing a stolen handgun. He posted $1,000 cash bail in February and was free until Thursday’s shooting. His Friday court appearance was on the gun charge.

It’s unclear, however, if or why Al Khammasi was not deported in the five years.

Al Khammasi was charged with attempted first-degree murder, possession of a weapon by a previous offender and felony menacing on Friday. He is being held without bond.