ISLAMABAD -- A Pakistani court charged five young Americans on Wednesday with planning terrorist attacks in the South Asian country and conspiring to wage war against nations allied with Pakistan, their defense lawyer said.

The men -- all Muslims from the Washington, D.C., area -- pleaded not guilty to a total of five charges, the most severe of which carries a maximum sentence of life in prison, defense lawyer Hasan Dastagir told The Associated Press.

"My clients were in good shape and high spirits," said Dastagir.

The men were charged by an anti-terrorism court inside a prison in Sargodha, the city in Punjab province where they were arrested in December. They were reported missing by their families in November after one left behind a farewell video showing scenes of war and casualties and saying Muslims must be defended.

Their lawyer has said they were heading to Afghanistan and had no plans to stage attacks inside Pakistan.

More On This...

The court also charged the men with planning attacks on Afghan and U.S. territory, said Dastagir. The charges did not specify what was meant by U.S. territory but could be a reference to American bases or diplomatic outposts in Afghanistan.

The men were also charged with contributing cash to banned organizations to be used for terrorism and with directing each other to commit terrorist acts.

"This last charge carries life in prison while the rest of the charges have lesser punishments," said Dastagir.