SACRAMENTO, Calif. (AP/CBS13) — A federal judge in Sacramento refused Wednesday to allow the extradition to Iraq of a man accused of committing a killing for the Islamic State, saying cellphone evidence shows he was in Turkey at the time of the slaying.

The U.S. Justice Department has tried since 2018 to return Omar Abdulsattar Ameen to Iraq under a treaty with that nation.

READ MORE: California Expands Drought Emergency To Large Swath Of State

He fled to Turkey in 2012 and in June 2014 was granted status as a refugee in the United States on the grounds that he was a victim of terrorism.

But prosecutors said that he returned to Iraq that same month to kill a police officer in the town of Rawah after it fell to the Islamic State. Five months later, Ameen traveled to the United States to be resettled as a refugee. Ameen had been living in an apartment in the Arden Arcade area when he was detained.

U.S. Magistrate Judge Edmund Brennan said Wednesday that Ameen’s cellphone records “appear decisive on the most salient point: Ameen was in Turkey, not Iraq, on the day of the murder.”

He rejected prosecutors’ request that he rule that Ameen was eligible for extradition. That would have forwarded the matter to the U.S. State Department for a final decision.

There is no appeal from the ruling, and Brennan ordered Ameen released from custody barring any criminal or immigration charges in the United States.

The U.S. attorney’s office in Sacramento did not immediately comment.

“We’re hoping the government is going to realize, not only is there no strong case against Omar, but there’s no sense in prosecuting an innocent man or pursuing an innocent man any further,” said Benjamin Galloway, one of Ameen’s public defenders.

The FBI’s Joint Terrorism Task Force had been investigating Ameen since 2016 and independently corroborated Ameen’s involvement, according to an earlier court filing.

But Ameen passed a lie detector test and immigration sign-in sheets showed he was in Turkey within days on either side of the killing 600 miles away across a war-torn border, the judge noted.

Given the defense evidence, the government’s theory that he was quickly in and out of Iraq to commit murder “is simply not plausible,” Brennan wrote, calling it “a dubious account.” He said he had “serious doubt” on the reliability of witnesses who placed Ameen in Iraq at the time.

READ MORE: Gov. Newsom Proposes Budget That Would Send $600 Stimulus Checks To Two-Thirds Of Californians

The case at the time drew criticism from the Trump administration of the resettlement program’s vetting process under the Obama administration for not doing enough to keep out terrorists.

The Iraqi government said Ameen was part of a four-vehicle IS caravan that opened fire on the home of the Rawah police officer, Ihsan Abdulhafiz Jasim. Ameen killed him with a shot into the man’s chest as he lay on the ground, according to Iraqi documents. Islamic State later claimed responsibility for the slaying on social media.

Brennan called it “regrettable” that the allegations against Ameen took more than two years to resolve.

“The record before the court, taken in its entirety, does not establish probable cause that he was responsible for Jasim’s murder,” Brennan ruled.

U.S. officials alleged that Ameen kept his membership in two terrorist groups a secret when he applied for refugee status, and later when he applied for a green card.

Galloway met with Ameen in jail shortly after the ruling and said he was very emotional and incredibly relieved. He said it would be difficult for the government to now bring charges that Ameen made false statements on his immigration documents, given the judge’s decision.

Despite being ordered to be released, Ameen was later taken into custody by ICE, according to his attorney.

MORE NEWS: Car Crashes Into Sutter County Home, Catches Fire

If he were returned to Iraq, Ameen could face execution, according to Iraqi documents filed in U.S. federal court.