The accused New York bomber posted on his Facebook account: "Trump, you failed to protect your nation" before attempting a suicide attack at city's main bus terminal, prosecutors claim.
Bangladeshi immigrant, Akayed Ullah, 27, has been charged with terror offences after he allegedly strapped a crude pipe bomb to his body and detonated during rush hour on Monday.
He was seriously wounded in the attack with burns to his hands and body and three other people suffered minor injuries.
A criminal complaint in Manhattan federal court said Ullah told authorities he "did it for the Islamic State".
Federal authorities have charged him with providing material support to terrorists and using weapons of mass destruction.
He was expected to appear before a magistrate judge, but it was not immediately clear if he was well enough to go to court.
A search of his Brooklyn apartment recovered a passport with the words "O America, die in rage" scrawled in it, the complaint said.
He hoped to "terrorise as many people as possible" with a bomb filled with metal screws that he believed would cause maximum damage, the complaint said.
According to the complaint, Ullah began researching how to build bomb after he had "viewed pro-Isis materials online, including a video instructing, in substance, that if supporters of Isis were unable to travel overseas to join Isis, they should carry out attacks in their homelands".
Bangladesh counter-terror officers are questioning Ullah's wife and other relatives in his home country.
Relatives and police said Ullah last visited Bangladesh in September to see his wife and newborn son. He left both behind when he returned to the US.
Bangladesh's government condemned the attack and released a statement declaring their policy of zero tolerance against terrorism.
Ullah, who was living in Brooklyn, arrived in the US in 2011 and the Department of Homeland Security said he's a lawful permanent resident.
He came to the US on a visa issued to him based on a family connection to a US citizen.
A White House spokeswoman said the incident shows the need for "immigration reform".
Law enforcement officials familiar with the investigation said Ullah had looked at Islamic State group propaganda online and told investigators he was retaliating against US military aggression.
Ullah, whose family said in a statement that it was heartbroken, is not believed to have had any direct contact with the group.
Mayor Bill de Blasio said all of the victims had suffered minor injuries.
"Thank God the perpetrator did not achieve his ultimate goal," he said.
Footage has emerged showing the suspect walking through the crowded underpass before a plume of white smoke appears and the explosion sends commuters running.
As the smoke clears, the suspect can be seen laying crumpled on the ground.