NEW YORK -- An immigrant from Bangladesh arrested on charges of using a weapon of mass destruction in the New York City subway system in an attempted suicide bomb attack has been charged in federal court. Akayed Ullah, 27, was expected to appear before a magistrate judge after a criminal complaint was made public Tuesday.

The signed complaint in Manhattan federal court says Ullah told authorities he "did it for the Islamic State."

According to the complaint, Ullah posted on his Facebook account on his way to carry out the Monday morning attack: "Trump you failed to protect your nation." Ullah told authorities he carried out the attack in part because of the U.S. government's policies in the Middle East.

During a search of his Brooklyn apartment, investigators recovered a passport with the words "O America, die in rage" scrawled in it, the complaint says.

Akayed Ullah New York City Taxi and Limousine Commission

Speaking at a press conference Tuesday, Joon Kim, the acting U.S. Attorney for the Southern District of New York, called that phrase "chilling." He said Ullah entered the busy pedestrian tunnel with a "hateful heart and and evil purpose," and he vowed that Ullah will face justice.

Get Breaking News Delivered to Your Inbox

"That justice will be tough, it will be fair, and it will be swift," Kim said.

Federal authorities charged Ullah with providing material support to a terrorist organization and using weapons of mass destruction. The blast left Ullah with burns to his body and hands. Several nearby pedestrians suffered minor injuries including hearing trouble and headaches.

Authorities say Ullah set off a bomb in the underground passageway near Times Square and the Port Authority bus terminal. Port Authority police officers arrested him, finding a nine-volt battery in his pants pocket with wires connected to it that ran underneath his jacket, plastic zip ties, fragments of metal pipe, remnants of Christmas tree lights attached to wires, and metal screws, the complaint says.

The device was affixed to his body, said John Miller, the deputy commissioner of intelligence and counter-terrorism for the NYPD. A federal law enforcement official told CBS News' Jeff Pegues the device malfunctioned, and that "it did not fully detonate which possibly caused the injury."

The complaint says Ullah later spoke to authorities from his hospital bed after waiving his Miranda rights, saying he assembled the pipe bomb at a Brooklyn apartment and filled it with metal screws "which he believed would cause maximum damage."

The complaint says he chose to carry out the attack on a weekday because "he believed that there would be more people" and that his goal was to terrorize as many people as possible.

"His intention was to cause mass destruction, and to do so in a vicious manner," said Benjamin Tucker, NYPD first deputy commissioner, at Tuesday's press conference.

Ullah started collecting materials for the bomb two to three weeks before the bombing, and started building the device about a week ago, the complaint says. CBS News' senior investigative producer Pat Milton reported that he obtained the materials at work, though it's not clear where his workplace is.

Items such as wire, screws consistent with the ones found in the device and fragments of Christmas tree lights were found in his apartment, the complaint says.

According to the complaint, Ullah started to become radicalized in 2014 and began researching how to build the 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."

Ullah came to the U.S. from Bangladesh with his parents in 2011 on a visa available to certain relatives of U.S. citizens. Overseas, Bangladesh counterterrorism officers were questioning Ullah's wife and other relatives, officials there said Tuesday. Relatives and police said Ullah last visited Bangladesh in September to see his wife and newborn son before leaving them behind to return the United States.

Police spoke with Ullah's family in Brooklyn's Flatlands section, CBS New York's Marcia Kramer reported. Ullah lived with his father, mother and brother in a residential area with a large Bangladeshi community, neighbors told the Associated Press.

Investigators were searching his apartment, interviewing witnesses and relatives and looking for surveillance footage that may show his movements in the time leading up to the attack.

His family was "deeply saddened" by the attack but also "outraged by the way we have been targeted by law enforcement," the family said in a statement sent by the New York Chapter of the Council on American-Islamic Relations. A teenage relative was pulled out of class and questioned in school without a parent, guardian or lawyer, the statement said.

Commuters exit a train as police officers stand in a closed-off underground walkway near the site of a pipe bomb explosion in the tunnel that connects the Times Square subway station to the Port Authority Bus Terminal, December 11, 2017 in New York City. Drew Angerer / Getty Images

Speaking Tuesday on "CBS This Morning," Miller said it's getting harder to stop so-called "lone wolf" attacks. He said Ullah wasn't on the NYPD's or the FBI's radar before Monday's incident.

"I think what we saw yesterday is something that could have been far, far worse," he said.

It was not immediately clear who would represent Ullah in court.