Alexandria, Virginia (CNN) -- A former Marine Corps reservist pleaded guilty Thursday to shooting at the Pentagon and other military-related buildings and to trying to desecrate graves at Arlington National Cemetery containing the remains of veterans who fought in Iraq and Afghanistan.
Yonathan Melaku entered a guilty plea to three counts: damaging U.S. property with a firearm, using a firearm in a crime of violence and attempting injury to veterans' memorials on U.S. property.
Melaku, a 23-year-old naturalized U.S. citizen who was born in Ethiopia, was arrested June 17 at the cemetery. He had a backpack with four plastic bags each containing 5 pounds of ammonium nitrate, material commonly used in homemade explosives. He also had numerous 9 mm spent shell casings; black paint and a notebook with Arabic statements mentioning al Qaeda, Osama bin Laden, the Taliban and the "Path to Jihad."
In the statement of facts document signed by Melaku, he admitted he "intended to desecrate and injure grave markers by spray-painting the markers with Arabic statements and by leaving the ammonium nitrate he was carrying at the sites of these grave markers."
Melaku did not have all the components needed to make a bomb. In a search of his home, investigators found a typed list that included various components including batteries, wire and a "digital kitchen countdown timer." But he had not obtained all of those items.
Melaku admitted to five shootings with a legally owned handgun at military buildings in Northern Virginia between October 17 and November 2 of 2010. He said he attacked the Pentagon, Marine and Coast Guard recruiting offices and he twice fired at the National Museum of the Marine Corps.
The government released a video Melaku made showing his second attack at the Marine Corps museum in Quantico, Virginia, on October 29. Recorded Arabic music is heard in the background as Melaku drives down an interstate talking about his target. "Last time I hit them, they turned off the lights," Melaku is heard saying. "Punks! Now, here we go again. This time, I'm going to turn it off permanently."
Melaku then says, "That's the target. That's the military building that's going to, gonna get attacked."
Melaku's face is shown on part of the video but he's also seen wearing a black hood as he prepares to shoot at the museum, although the building is not visible on the video. Shots ring out in rapid succession.
Then Melaku excitedly yells, "Allahu Akbar" several times and also sings along with the recorded music playing in his car.
According to court documents, the five military building shootings caused more than $100,000 in damage.
Melaku, wearing a green jail jumpsuit on Thursday, spoke only to respond to questions from U.S. District Judge Gerald Bruce Lee. Asked how he was pleading to the three counts against him, Melaku replied, "Guilty, sir."
After the hearing, Assistant U.S. Attorney Dana Boente said Melaku indicated in the video he made at the Marine museum shooting that his intention was to "create fear and terror, which is what terrorists do" and that he wanted to shut down the building.
Boente also said Melaku had "a large amount of jihadist material on his computer."
FBI Supervisory Special Agent Jacqueline Maguire would not list which websites Melaku used, but said a search of the computer showed he was "conducting research" relating to the list of needed bomb components found at his home.
U.S. officials have said Melaku has no ties to any terrorist groups and appears to have acted alone.
Prior to the plea deal, Melaku faced the possibility of life in prison if convicted on all charges. But the plea agreement calls for him to serve 25 years followed by five years of supervised release. He will be sentenced on April 27.
Melaku offered no explanation for his actions at Thursday's hearing. His defense lawyer, Gregory English, asked that his client receive a mental examination and suggested he might need treatment while in prison.
English emphasized Melaku was competent and understood the legal proceedings, but said his parents were concerned he might have problems with anger management or post-traumatic stress. Judge Lee said it was an unusual request since no mental issues were raised before the guilty plea, but he said he would consider the matter.
Melaku joined the Marine Reserves in August of 2007 but was never deployed overseas. At the time of his arrest in June last year, a military official told CNN that Melaku had failed a combat fitness test about a month before the first military building shooting. The official said he later did poorly on a physical and was listed as non-deployable.