The Bangladeshi man accused of strapping a pipe bomb to his body and detonating it in a subway passageway Monday wrote on Facebook before the attack that President Trump “failed to protect” the U.S. and left handwritten notes in his home saying, “O America, die in your rage,” a criminal complaint against Akayed Ullah stated.

Ullah, a 27-year-old who lived in Brooklyn and entered the U.S. in 2011 via chain migration, was the only person seriously injured when his crude device was detonated just before 7:30 a.m. in a crowded subway passageway near Port Authority.

The suspect told authorities he planned the attack “for the Islamic State” and was angry about the U.S. policies in the Middle East, according to the criminal complaint released on Tuesday.

On his Facebook page, Ullah wrote: “Trump you failed to protect your nation.”

The pipe bomb was packed with explosive powder, but it didn’t go off as intended when he ignited it with Christmas lights, matches and nine-volt battery, the complaint said. The device was filled with metal screws to “cause maximum damage” and attached to his body with zip ties. New York City Mayor Bill de Blasio called the episode an “attempted terrorist attack.”

But just before Ullah arrived in midtown Manhattan, he took the train from his Brooklyn home, sitting next to scores of unsuspecting commuters for about an hour, the New York Daily News reported.

“He got on the train ready to go,” a law enforcement source told the New York Daily News.

PORT AUTHORITY EXPLOSION SUSPECT: WHAT WE KNOW ABOUT AKAYED ULLAH

Ullah told police he chose the specific spot in the passageway after he saw a Christmas poster, the source said, adding: “He said he set it off at that place and time. That's the point where he decided to do it.”

Ullah was charged Tuesday with supporting an act of terrorism, making terroristic threats and criminal possession of a weapon. He remains in the hospital and is expected to be arraigned later Tuesday or Wednesday.

Ullah began radicalizing as early as 2014, the complaint stated, adding that he had looked at ISIS propaganda online, including instructions on carrying out an attack in the U.S. if they couldn’t travel overseas to join ISIS. He learned how to make the bomb online about a year ago and spent the last two to three weeks planning the attack. Ullah also wasn't on the radar of law enforcement officials prior to the attack, John Miller, NYPD deputy commissioner of intelligence and counterterrorism, told CBS on Tuesday.

Multiple handwritten notes, including one that stated, “O America, die in your rage” were found littered among bomb-making materials in his Brooklyn home.

The suspect lived with his mother, sister and two brothers and returned to Bangladesh in September to see his wife and newborn son. Law enforcement sources also told Fox News Ullah had “extensive overseas travel.”

Ullah's uncle, Abdul Ahad, said the suspect mostly remained inside a small apartment in Dhaka's Hazribagh area when he recently visited Bangladesh.

"He went out of his residence to offer prayers at a nearby mosque," Ahad told The Associated Press.

He said Ullah arrived in Bangladesh on Sept. 8 and returned to New York on Oct. 22.

"He stayed with his wife and 6-month-old baby boy," he said, adding Ullah was a quiet person who rarely socialized.

Authorities in Bangladesh were working to track down extended family members and any possible associates of Ullah, who has no criminal record in Bangladesh, Reuters reported.

“Police are looking for his family, but so far they’ve not been able to trace them,” Abul Khair Nadim, the Chair of Musapur Union council, said.

Ullah’s family members also released a statement saying they were deeply saddened by the attack but also expressing outrage for the way Muslims have allegedly been targeted by law enforcement. The family said it expects more from the justice system.

The Associated Press contributed to this report.