A federal judge has denied bail for a Massachusetts man accused of plotting to fly remote-controlled model planes packed with explosives into the Pentagon and the U.S. Capitol.

The judge said in the decision issued Monday that 26-year-old Rezwan Ferdaus is a "danger to the community" with a "dedication to his cause."

Ferdaus, a Muslim American with a physics degree from Northeastern University, was arrested in Framingham in September after federal employees posing as al-Qaida members delivered what he believed was 24 pounds of C-4 explosives.

Lawyers for the Ashland man said Ferdaus has mental health issues and had a "completely unrealistic fantasy."

They wanted Ferdaus released on bail and placed in the custody of his father while awaiting trial.

Prosecutors said Ferdaus' anger at the U.S. warranted detention.