NEW YORK — He rose before the sun in his Brooklyn home and strapped his deadly parcel to himself with zip ties and fasteners.

His goal: to send a twisted anti-American message and kill dozens of people at one of the world's busiest transit hubs.

Akayed Ullah, his 27-year-old mind fermenting with thoughts of martyrdom for the Islamic State, donned a dark hooded jacket and a dark backpack to cover his homemade bomb and fell in with New Yorkers on a train beginning their regular work week.

The weapon he had chosen to sow death that morning was a 12-inch pipe, filled with powder and detonated by a pulse from a broken Christmas bulb, powered by a 9-volt battery.

At 6:25 a.m. Monday, a security camera captured him as he began to climb the stairs to the platform of the 18th Avenue subway station.

"He got on the train ready to go," a law enforcement source said.

The Bangladeshi native living here legally switched to the A train at the Jay Street/MetroTech station and exited the train at the Port Authority Bus Terminal stop. He walked east in the passageway that leads to the Times Square station.

Ullah told police he detonated the bomb after seeing a Christmas poster.

The ISIS admirer likely passed hundreds of straphangers on his 55-minute journey before he detonated the crude explosive in the heavily trafficked area around 7:20 a.m.

"He said he set it off at that place and time. That's the point where he decided to do it," the source said.

Panicked commuters flooded out of both stations.

"Everybody breaks out, hitting steps," said Jamar Moore, 39. "People started getting trampled. I see about three to four people falling. Shoes are coming off."

Security guard Christina Bethea, 29, of Yonkers, was another face in the crowd who found herself tangled in chaos.

"At the end of the tunnel, we heard the explosion. Boom!" she said. "You could see the smoke coming. When I saw the smoke, I just ran up the stairs."

Four Port Authority police officers rushed into the smoke and tackled the suspect.

Wires ran from the suspect's jacket to his pants with something on his body under his coat, sources said. He was reaching for a cellphone. The officers cuffed him and took the backpack and anything else that might be a threat.

The officers were identified as Anthony Manfredini, 28, Jack Collins, 45, Sean Gallagher, 26, and Drew Preston, 36.

The mayhem in between two huge transit hubs crippled the morning rush-hour, but just three commuters suffered injuries and they were minor, officials said.

It could have been a lot worse.

Times Square sees more than 200,000 riders each weekday across 12 lines, while about 220,000 people move through the Port Authority Bus Terminal bus and train lines daily.

"This was an attempted terrorist attack," Mayor Bill de Blasio said. "Thank God the perpetrator did not achieve his ultimate goals. Thank God the only injuries we know about at this point are minor."

Added Gov. Andrew Cuomo, "The reality is that we are a target by many who would like to make a statement against democracy. ... Let's go back to work. We are not going to allow them to disrupt us."

Meanwhile, as the day progressed, details emerged about the bomber.

"He says he did it in the name of ISIS," a law enforcement source said. "He says he acted alone. He said he's been following ISIS on the internet."

Ullah entered the U.S. legally in 2011 from Bangladesh. He visited his home country Sept. 8.

He told investigators he found the instructions for the bomb online, the law enforcement source said.

"He was pretty forthcoming. He talked about the Quran," the source said.

Another source said, "Ullah spoke angrily of how Muslims were treated during the Bush and Obama administrations."

He also was angry about airstrikes against ISIS targets in Iraq and Syria.

Ullah, who formerly held a livery car driver's license, was taken to Bellevue Hospital with burns to his hands and abdomen, and lacerations. He is expected to survive, sources said.

Aides to President Donald Trump used the terror attack to blast immigration laws that allowed Ullah to enter the country because he had relatives here — a policy Trump calls "chain migration."

"The president's policy has called for an end to chain migration and if that had been in place, that would have prevented this individual from coming to the United States," said White House spokeswoman Sarah Huckabee Sanders.

Ullah, sources said, also might have been motivated by Israel's recent crackdown on the Palestinians, and particularly by Trump's decision to recognize Jerusalem as the capital of Israel — a notion that infuriates Muslims.

Two of the three injured people took themselves to Mount Sinai West hospital, and one went on their own to Mount Sinai Queens. They were treated for ringing in the ears, headaches and chest pains.

"We have every confidence that our justice system will find the truth behind this attack," said Albert Cahn of the New York chapter of the Council on American-Islamic Relations.

Cahn claimed police had been overly aggressive with younger members of Ullah's family.

Authorities evacuated the A, C and E trains, but didn't find any structural damage. The Times Square station also was evacuated. Trains on both lines were bypassing the stations through the morning, officials said. By the evening commute, things had returned to normal.

Cops flooded an address connected to Ullah's family on East 48th St. in the Flatlands section of Brooklyn, and shut down the block.

Kisslyn Joseph, 19, a neighbor, said she could hear someone pacing there before dawn Monday.

"I could hear somebody on the phone, and it was kind of strange," she said. "It was the tone of voice, and they were swearing."

Detectives also went to a building on Newkirk Avenue in Brooklyn — possibly a garage — where Ullah might have stored equipment, sources said.

The FBI's Joint Terrorism Task Force was brought in to help investigate the attack.

Ulises Sanchez, 53, saw people come pouring out on the street after the blast.

"A lady told me, 'Go away. There was an explosion down there,' " Sanchez said. "Everybody was trying to get out."

The blast comes amid calls from ISIS to attack the Big Apple during the Christmas season, and follows the Halloween terror attack in lower Manhattan.

Sayfullo Saipov, a 29-year-old Uzbekistan immigrant, has been charged with speeding down the West Side bike lane in a rented Home Depot truck, killing eight people and injuring 12 on Oct. 31.

Saipov, who said he also was inspired by ISIS, has pleaded not guilty and is waiting trial.

On Sept. 17, 2016, Ahmad Rahimi of Elizabeth, N.J., detonated a pressure cooker bomb filled with shrapnel on West 23rd Street between Sixth and Seventh avenues.

Rahimi was captured two days later in Elizabeth and pleaded guilty to planting that bomb and others.

After the Monday blast, Bethea said she called her family.

"I thought, this is not the place to be right now," she said. "I thought, 'Damn, I'm moving back to Carolina. I don't want to live in New York anymore.' "