NEW YORK (Reuters) - A man accused of setting off bombs in New York and New Jersey which wounded 30 people last September has lost a bid to dismiss charges of attempted murder and other crimes stemming from his shootout with police after a manhunt.

FILE PHOTO: Ahmad Khan Rahimi, an Afghan-born U.S. citizen accused of planting bombs in New York and New Jersey, appears in Union County Superior Court for a hearing in Elizabeth, New Jersey, U.S., on May 15, 2017. REUTERS/Mike Segar/File Photo

In an opinion made public on Thursday, a New Jersey judge rejected Ahmad Rahimi’s argument that the indictment should be thrown out because prosecutors improperly recommended charges to a grand jury and that they failed to show he was deliberately trying to kill officers when he fired.

Rahimi, 29, also faces federal charges in New York for setting off an explosive device in New York City’s Chelsea neighborhood that injured 30 people, though no one died. Authorities have accused Rahimi of planting another bomb at a road race in New Jersey that detonated but did not hurt anyone, as well as several other bombs that did not go off.

Federal prosecutors have portrayed him as a jihadist who bought bomb components on eBay, praised Osama bin Laden and kept a journal expressing outrage at the U.S. “slaughter” of mujahideen fighters in Afghanistan, Iraq, Palestine and Syria.

Rahimi’s court-appointed lawyer in the New Jersey case, Peter Liguori, did not immediately respond to a request for comment.

Rahimi engaged in a shootout with police in Linden, New Jersey, two days after the bombings following an intense manhunt, according to authorities. Two officers were wounded, while Rahimi was badly injured after being struck by several bullets.

Liguori had asked Union County Superior Court Judge Regina Caulfield to dismiss all charges because of “prosecutorial misconduct,” arguing that the district attorney’s office improperly pressed the grand jury to indict Rahimi on specific charges.

Liguori also said three of the five attempted murder charges should be reduced to aggravated assault because prosecutors could not show that Rahimi intended to hit them when he fired wildly while running away.

But Caulfield rejected those arguments, finding prosecutors appropriately proposed possible charges to the grand jury and that there is enough evidence to support the allegation that Rahimi tried to kill the officers.

Rahimi’s federal trial in New York is scheduled for October, after his lawyers in that case unsuccessfully tried to have the trial moved to another state, citing extensive media coverage.

A similar attempt to move his New Jersey state trial, which has not been scheduled, was also denied.