US police have charged Ahmad Khan Rahami with planting bombs in New York and New Jersey.
A bomb went off in the Chelsea neighbourhood of Manhattan on Saturday, injuring 31 people.
Mr Rahami was already charged by the state of New Jersey with the attempted murder of police, during his arrest.
The new federal charges include use of a weapon of mass destruction, bombing, destruction of property and use of a destructive device.
A charge sheet before the Manhattan federal court sheds new light on Mr Rahami's motivations.
His journal apparently expressed the wish to die a martyr, the criminal complaint revealed.
One passage said: "You [US government] continue your [unintelligible] slaught[er]" against the mujahideen, or holy warriors, be it Afghanistan, Iraq, Sham (Syria), Palestine."
Another refers in glowing terms to Osama Bin Laden, Anwar al-Awlaki, a US-born Muslim cleric killed in a 2011 drone strike, and Nidal Hasan, a former army officer who killed 13 people at a Texas Army base in 2009.
Investigators say Mr Rahami, 28, planted two bombs in Chelsea but one failed to detonate.
Another bomb exploded in a New Jersey seaside town earlier on the same day but no-one was hurt.
He is also accused of leaving explosives in a discarded rucksack in a rubbish bin in Elizabeth, New Jersey.
Mr Rahami was preparing for months for the attack, the court documents suggest.
He bought some bomb-making equipment on eBay and was filmed by a relative lighting "incendiary material" in a bin.
The series of bombings over the weekend have sparked a heated debate about national security between the two presidential candidates, days before their first televised debate.
Republican Donald Trump has seized on the fact Mr Rahami was born in Afghanistan to bolster his tough stance on immigration admissions.
But his Democratic rival, Hillary Clinton, has accused Mr Trump of enabling the terrorists by playing into their hands.
Mr Rahami is still in hospital, recovering from injuries sustained during the shootout that led to his arrest.