Alexandria, Virginia (CNN) -- Farooque Ahmed, accused of helping what he thought was an attempt to bomb Metro stations in the Washington area last year, pleaded guilty to two charges Monday in U.S. District Court.

He was immediately sentenced to 23 years in prison.

Ahmed had pleaded not guilty last year. In changing his plea, he admitted that he attempted to provide material support to a designated terrorist organization. He also pleaded guilty to collecting information to assist in planning a terrorist attack on a transit facility.

In court documents, Ahmed admitted performing surveillance at Metro stations near the Pentagon, taking videos and making diagrams of possible places to locate bombs. He suggested between 4 and 5 p.m. "would be the best time to stage an attack to cause the highest number of casualties" in several simultaneous explosions, according to a statement of facts signed by Ahmed.

Prosecutors said Ahmed thought he was helping members of al Qaeda, but in reality he was providing information to people working for the U.S. government.

Ahmed, a 35-year-old naturalized U.S. citizen who was born in Pakistan, appeared in court wearing a dark green jail jumpsuit. "All I can say is I'm sorry," Ahmed told the court. "It was the wrong action."

"There is no form of Islam that condones killing women and children or innocents," said U.S. District Judge Gerald Bruce Lee. Lee also ordered that Ahmed's prison term be followed by 50 years of supervised release.

Speaking to reporters after the court hearing, U.S. Attorney Neil MacBride said government operatives did not have to entice Ahmed into terrorism.

"The interest in killing Americans, the interest in committing jihad, the interest in becoming a martyr all originated with Mr. Ahmed himself," MacBride said. "That was long before he came into contact with the FBI."

MacBride also said those posing as al Qaeda operatives asked Ahmed to check three Metro stations and Ahmed then suggested a fourth. "His reason was that he could maximize casualties. He wanted to kill as many people as possible."

U.S. officials believe that Ahmed was working alone, MacBride said, and that the public was never in danger because his activities were being closely monitored.

Federal public defender Kenneth Troccoli said Ahmed accepted full responsibility for his actions. Troccoli suggested one of the reasons Ahmed might have been drawn into plotting terrorism was that Muslims are constantly hearing messages urging radical action.

"That can unfortunately create resentment and a feeling among believers of Islam that they are not truly Islamic unless they do some of these things," Troccoli said.

Authorities found three weapons at Ahmed's home at the time of his arrest in late October: a Smith & Wesson pistol, a 12-gauge double-barrel shotgun and a Remington rifle, along with ammunition.

Also discovered was a biography of American-born Yemeni cleric Anwar al-Awlaki.