Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A New Jersey man allegedly inspired by ISIS and al Qaeda to plant bombs in New York City and New Jersey was sentenced to life in prison on Tuesday — after complaining that he was being discriminated against for being Muslim.

"I don't harbor hate toward anyone," Ahmed Khan Rahimi said during a rambling statement in which he defended his family and criticized the FBI, prosecutors and prison officials.

But, he added, "I have come to understand why there is such a big frustration between Muslims overseas and the American people."

Ahmad Khan Rahimi appears in court in 2017. Mike Segar / Reuters file

Rahimi, 30, claimed that he was harassed by federal authorities while traveling in Muslim garb. "I was singled out," he said.

He mocked prosecutors for referring to his diary as a letter, suggested he was punished for minor rule breaking in prison and even seemed to blame the FBI for not doing more to stop him when he was briefly investigated him in 2014.

Rahimi, 30, said nothing about the victims of the September 2016 blast in Manhattan's Chelsea neighborhood that injured 30 people — which prosecutors noted in asking for the maximum sentence.

"Mr. Rahimi just stood here for the last 10 minutes and blamed everyone else for his actions," Assistant U.S. Attorney Shawn Crowley said. "He is unrepentant. He shows no sympathy for his victims."

A half-dozen victims sat in the front row of the courtroom to see Rahimi sentenced. One of them, Pauline Nelson, told Rahimi that she cries every time she thinks of the night the bomb exploded near a car she was in.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

"You have no remorse," Nelson said. "God forgive you."

Rahimi was convicted in October of eight federal counts stemming from two explosive devices: the one that detonated in a dumpster in Chelsea, and another left blocks away that didn't go off.

Judge Richard Berman looks on as Ahmed Rahimi stands during his sentencing, with his attorney Xavier Donaldson stands behind him. Christine Cornell

One of the counts called for a maximum life sentence so his punishment was preordained, but U.S. District Judge Richard Berman also gave him the maximum on the other counts for a total of two life sentences plus 30 years.

Berman noted it was miraculous the Chelsea bomb didn't kill anyone.

"It's inexplicable that anyone would do that intentionally," he said. "But it's clear from the evidence and the record that you did."

Rahimi's attorney, Xavier Donaldson, said they plan to appeal. Asked why his client had not expressed remorse, he called him "a complicated person."

Rahimi is also accused of planting a bomb near a race route in Seaside Heights, New Jersey, that detonated before the runners passed by, and of leaving six bombs in backpack near the Elizabeth, New Jersey, train station. He is awaiting trial in New Jersey on those charges.

Rahimi, a naturalized U.S. citizen who was born in Afghanistan, was arrested after a gunfight with New Jersey police, who found he was carrying a journal with praise for Islamic terrorists and promises of violence.

Rahimi — a father of three who had worked in his family's fried-chicken restaurant — was not charged with terrorism, but his father said he has no doubt that's what fueled his son.

The father, Mohammad Rahimi, told NBC New York on Monday that he told the FBI in 2014 that he was worried his son might have been radicalized.

"After two months, they say, 'Your son is not doing any act like a terrorist,'" Rahimi. said "I said, 'You sure he not doing anything?' He say, 'Yeah, is good news.'"

"My son, he did wrong, and the FBI did the wrong, too," the father added. "The government is responsible for that reason. They have the power to stop the crime and they did not stop the crime."

In court, Rahimi echoed his father's remarks, seeming to blame the FBI for not stopping him sooner.

"My father did his best to try to quell everything down," he said. "He feels like the system failed him."

The FBI has said that the bomber's father did not tell them about his son's possible terrorist leanings.

Federal prosecutors say that after his arrest, Rahimi passed on terrorist propaganda and instructions on how to make explosives to other inmates.

Rahimi railed at that accusation in court, saying one of the inmates had been "groomed" by the FBI in a sting operation and was radicalized long before they ever crossed paths.