The family of the Chelsea bombing suspect has a history of legal troubles with officials of their New Jersey town — filing a federal lawsuit against the city of Elizabeth claiming they had been unfairly discriminated against because of their race and ethnicity.

Ahmad Khan Rahami’s family sued the city following a ruling from the city council that forced them to close their 24-hour restaurant, First American Fried Chicken, at 10 p.m. every night because of noise complaints from people who lived nearby.

“They kept getting complaints from neighbors. It was a distress to people in the neighborhood,” Mayor Christian Bollwage said at a press conference Monday morning outside the Elmora Avenue restaurant, which Rahami’s family lived above.

The lawsuit, filed in 2011, named the mayor, the city council and 20 police officers.

But Bollwage insisted Monday that the city council’s early closure ruling was not racist.

“It was neighbor complaints. It had nothing to do with his ethnicity or religion,” he said at a press conference, according to the New York Times. “It had to do with noise and people congregating on the streets.”

Frequent customers at the Elmora Avenue greasy spoon said 28-year-old Rahami — who was being hunted in connection with the Chelsea blast over the weekend and was captured Monday morning after a shootout with police in Linden, New Jersey — said he was obsessed with cars.

“All this guy ever talks about is his cars. He loves fixing cars up and making them fast. All I ever heard him talk about was Honda Civics, Honda Accords, maybe an Acura. He would soup them up,” said Ryan McCann, 33, who frequently stops by the fried chicken joint with his family.

“His accent is Americanized,” McCann added.

Others said Rahami’s father, Mohammed, wasn’t as assimilated as his son and was sometimes mocked for wearing his traditional garb.

“People say racist stuff about him sometimes, like he looks like a terrorist, but no one would imagine anyone in his family could be an actual terrorist,” said 33-year-old Nelson Vilela, who lives a few blocks away. “If it’s true what they’re saying about this guy, he literally lives a couple blocks from a school. It’s very scary. You would never imagine someone of that nature living so close by.”

Bollwage said Rahami eventually lost his suit. Court records only show that it was “stayed’’ last year, meaning it is on hold. Rahami’s lawyer in the case did not return a phone call seeking comment.

While fighting with his neighbors and officials, Rahami also was struggling against bankruptcy, records show.

He filed for personal bankruptcy in 2005, claiming he earned less than $1,500 a month and had just $100 in the bank while facing nearly $40,000 in debt.

He had eight kids and drove a 1999 Chevrolet Suburban at the time, records show.

Additional reporting by Lia Eustachewich and Kate Sheehy