New Jersey bomb suspect Ahmad Khan Rahami was a chatty, friendly counter man at his family's fried chicken restaurant who sometimes gave pals free food when they were short of cash. But he changed profoundly after a trip abroad a few years ago, said friends.

When he returned, he was more stern. He grew a beard, exchanged his Western clothes for Muslim robes and prayed in the back of the restaurant.

"It's like he was a completely different person," long-time friend Flee Jones, 27, told the New York Times. "He got serious and completely closed off."

Rahami, 28, was arrested after a shootout with police near his home in Linden, New Jersey.

He has been charged with five counts of attempted murder for firing on police, officials said. He is also charged with second-degree unlawful possession of a weapon and second-degree possession of a weapon for an unlawful purpose.

Investigators said Rahami is "directly linked" to two pressure-cooker explosive devices in the Chelsea neighbourhood of Manhattan, one of which injured 29 people, and an explosion in Seaside, New Jersey, and is believed to be connected to pipe bombs in Elizabeth, New Jersey.

He is in hospital where he is expected to have surgery on his leg.

"We have every reason to believe this was an act of terror," said New York Mayor Bill de Blasio.

Ahmad Khan Rahami
Police believe this is Ahmad Khan Rahami who was captured on surveillance video near the scene of the bomb blast in the Chelsea neighborhood of Manhattan that injured 29 people Courtesy New York City Police Department

Now begins the process by investigators to untangle Rahami's journey from family-owned restaurant worker and naturalised American citizen to suspected terrorist bomb maker.

Friends thought Rahami had travelled to his birthplace of Afghanistan before his transformation began, but sources told the Times he went twice to Pakistan, once to Karachi and another time for a year in 2013 in Quetta – a stronghold of the Taliban – where he stayed with family and married, officials believe. He attempted to bring his pregnant wife back to America in 2011, but it is unknown if he did.

CNN reported that Rahami also travelled to Afghanistan several times, including during at least one of his trips to Pakistan.

Until he went abroad, he seemed like most American teens. He came to the country as a child 21 years ago and had an easy relationship with his friends. Jones said Rahami's parents let him host rap battles in the back of the restaurant, and Jones helped him write a song called Chicken Joint about the restaurant, which is called The First American Fried Chicken.

The family, who lived above the restaurant, did not have an easy relationship with the community or the police, however, and accused both of religious discrimination. Neighbours often complained about the restaurant's long hours and customer noise, and police turned up to investigate.

The Rahami family sued the city and its police department in 2011, claiming that they were harassed because of their religion. They said a local businessman told them: "Muslims make too much trouble in this country."

Rahami's father, Mohammad, reportedly told a family friend that he was from Kandahar and had been part of the mujahideen in Afghanistan that fought the Soviet Army. He opposed the war in Afghanistan, but was not anti-American, not did he support the Taliban, and hated Isis.

Investigators first identified Rahami on Sunday afternoon (18 September) through a fingerprint, a senior law enforcement official told CNN. A cell phone connected to one of the pressure-cooker bombs in Manhattan also provided some clues, the official said.

In addition to the blast in Manhattan's Chelsea neighbourhood on Saturday that injured dozens, a pipe bomb exploded in a New Jersey shore town before a charity 5K race. An unexploded pressure cooker device was also found blocks away from the blast site in Chelsea, and five explosive devices were discovered outside a train station in Elizabeth. One them exploded as a bomb squad robot attempted to defuse it.