(ABC News) -- Ahmad Khan Rahami, earlier named a person of interest in the weekend explosions in New York City and New Jersey, has been charged with five counts of attempted murder of a law enforcement officer. He is also charged with second-degree unlawful possession of a weapon and second-degree possession of a weapon for an unlawful purpose.
Rahami was taken into custody and hospitalized this morning after a shootout with police in Linden, New Jersey, the Union County acting prosecutor said today. He has been "directly linked" to the devices used in the New York and New Jersey explosions on Saturday, FBI official Bill Sweeney said. New York City Mayor Bill de Blasio said this afternoon there is "every reason to believe this was an act of terror."
But there is "no indication that there is a cell operating in the area or in the city," Sweeney said, adding that "the investigation is ongoing."
"We will continue to conduct investigative activity to ensure we completely understand Rahami's social network," Sweeney said. "For that reason, I do not plan to answer specific questions about our techniques, or our knowledge of the devices."
Rahami was taken into custody in Linden, about 4 miles south of Elizabeth, after being injured in the altercation, during which a responding officer was shot in his bulletproof vest and second officer was injured.
Rahami was taken to a hospital in Newark, where he is undergoing surgery, said Grace Park, the Union County acting prosecutor. The extent of his injuries was not immediately clear.
The confrontation happened at about 10:30 a.m., when an owner of a Linden bar reported that someone was sleeping in a hallway of his establishment, Linden Mayor Derek Armstead told ABC New York station WABC.
The bar owner, Harry Bains, told ABC station WABC in an exclusive interview that "it was my gut reaction" to call the police.
Armstead said, "One of our police officers went to investigate and to wake him up and realized that he was [Rahami], the suspect that had been being sought in the bombings."
"He realized it was the suspect, and within moments, the suspect fired on him," Armstead said. "And thank God that he had his vest on. And I think that was very helpful for him. I think that saved his life."
President Barack Obama said this afternoon that he spoke on the phone with the officers who apprehended Rahami.
"They are going to be fine, they sustained some modest injuries but ones that they’ll rapidly recover from," Obama said. "They were in good spirits and I communicated to them of how appreciative the American people are."
A source briefed on the investigation said agents are searching for other people they want to talk to and that the investigation is not over.
An alert sent shortly before 8 a.m. today said police were seeking a man in connection with the Saturday night bombing in Manhattan's Chelsea neighborhood -- identified by authorities as Rahami, 28. He is believed to be the man seen in surveillance video at both the scene of the explosion on West 23rd Street and on West 27th Street, where the unexploded device was found, a police source said.
His last known address was in Elizabeth, New Jersey. The address of a home searched by FBI agents in Elizabeth this morning is linked to a person with a similar name. Rahami is a U.S. citizen of Afghan descent.
Sources said authorities believe the three bombs -- one exploding in an oceanfront town on the New Jersey shore, one in Manhattan and another in Elizabeth, a town bordering Newark International Airport, just beyond New York City's borders -- are related.
Sweeney said today the explosion in Elizabeth is still under investigation.
The explosions did not cause any fatalities, but the Chelsea explosion injured 29 people.
The incident have put residents, police and other security personnel on high alert. De Blasio, on "Good Morning America" today, praised the NYPD's response to the threat and said the department has "the largest anti-terror force of any police force in the country."
The latest incident was Sunday night in Elizabeth, about 15 miles southwest of the Chelsea neighborhood in Manhattan. Police recovered five possible homemade pipe bombs in a backpack, and one device exploded early today as a police robot attempted to disarm it. The FBI's Newark office tweeted that its bomb technicians had responded to the scene, along with investigators from Union County and the State Police of New Jersey. No one was injured.
The Manhattan blast took place on West 23rd Street around 8:30 p.m. Saturday and injured 29 people. All the injured have been released from hospitals, Mayor de Blasio said.
New York Gov. Andrew Cuomo told reporters Sunday night there was no evidence of international involvement.
But he said today he considers the explosion an act of terrorism. "I believe it was an act of terrorism," he said. "I believe you set off a bomb and you try to set off a second bomb, that is an appearance of trying to intimidate New Yorkers."
He added, "Yesterday there was no hint of any connection to foreigner terrorism."
"No group had taken accountability. No group had put out a statement. It was very early in the investigation. It still is early. But there may very well turn out to be a link to foreign terrorist organizations," he said. "We will find that out today or in the coming days."
New Jersey Sen. Bob Menendez called the incidents "clearly an act of terrorism."
In the search after the Chelsea explosion, officials found a possible second device on 27th Street, said James O'Neill, the city's police commissioner. The second device, described as a pressure cooker, was removed and did not explode.
The first incident of the weekend was Saturday morning, when an apparent improvised explosive device was set off in Seaside Park, New Jersey, a beach town about 90 miles south of New York City.
The device went off along the route of a planned 5K charity race to benefit U.S. Marines and sailors. Because of delays with the start of the run, the explosion occurred before many people were nearby.
Officials announced late Sunday night the detention of up to five individuals in connection with Saturday night's explosion in Chelsea. No charges were made, and the individuals are no longer in custody, the FBI's Sweeney said today.
"I'm not going to discuss what they could face in the potential future," he said.
As the investigations continue, officials in New York City are preparing to host heads of government from around the world at the annual United Nations General Assembly this week in Manhattan. President Obama is among the speakers.
ABC News' J.J. Gallagher and Michael Edison Hayden contributed to this report.