Afghanistan's Defense Ministry said Monday that an Afghan soldier who shot and killed two U.S. troops the day before outside a top-security prison was mentally ill.

The gunman was shot dead by other Afghan troops at Pul-e-Charkhi prison, some 20 miles east of Kabul, said Maj. Sheldon Smith, a spokesman for Combined Security Transition Command, which trains Afghan security forces. The shooter also wounded two U.S. soldiers.

• More coverage is available in FOXNews.com's Afghanistan center.

Defense Ministry spokesman Zahir Azimi said Monday that the Afghan soldier had been hospitalized twice for mental illness. Azimi said the man had been in the army for a year and a half, and that shortly before the shooting, he had been behaving nervously around his fellow soldiers.

The four American soldiers were working as mentors to Afghan troops providing external security for the prison, Smith said. The prison is being revamped to house Afghans transferred from Guantanamo Bay.

The victims were not identified.

Afghan soldiers with their U.S. trainers have been deployed at the prison since the opening last month of a new high-security wing designed to eventually house Afghans released from the U.S. jail for terrorist suspects.

The revamp is supposed to improve security at the jail, which is infamous among Afghans for tales of torture and appalling conditions dating back to communist rule in the 1970s.

Since the U.S.-led invasion in 2001 that topped the Taliban, hundreds of Al Qaeda and Taliban suspects have been incarcerated there, some of whom have been involved in a series of deadly riots and breakouts.

Across Afghanistan, violence is escalating as insurgents and the military ramp up operations after a winter lull. On Monday, a rocket slammed into a street in the Afghan capital, Kabul, killing a man and wounding five others including a small boy, while a roadside bomb in the east killed a policeman, officials said.

An Associated Press tally has counted at least 43 suicide bomb attacks so far this year, which have killed about 100 people. Nearly half of the suicide attacks have left only the bomber dead.

• More coverage is available in FOXNews.com's Afghanistan center.