The lawyer said the court blocked any attempt to deport the five in response to a request filed by a human rights activist.
"They should not be handed over to the FBI or America or any other country until this petition is decided," said lawyer Tariq Asad from the eastern city of Lahore where the court heard the case.
"The court has restrained the government from handing the five over," he said.
There has been speculation that Washington may ask its regional ally Pakistan to deport the men back to the United States.
U.S. FBI agents and their Pakistani colleagues have been interrogating the young American Muslims who wanted to go to Afghanistan to fight U.S.-led forces, Pakistani officials said.
The five men, students in their 20s from northern Virginia, were detained last week in Sargodha in Punjab province, 190 km (120 miles) southeast of the Pakistani capital Islamabad.
The were taken to Lahore on the weekend.
The next hearing is expected on December 17.
The five men tried to contact militants and stayed in touch with each other through the Internet, Pakistani security officials said, highlighting the difficulty authorities face in trying to track and disrupt plots organized online.
The case has again focused attention on nuclear-armed Pakistan's performance in fighting militants as Washington presses Islamabad to root out Islamist fighters crossing the border to attack U.S.-led troops in Afghanistan.
Police have taken the first step toward filing charges with complaints based on laws pertaining to foreigners and the use of computers to organize crime.
According to documents issued by the police, the five are named Waqar Hussain Khan, Ahmed Minni, Ramy Zamzam, Aman Yemer and Umar Farooq.
Police in the southern port city of Karachi raided a hotel where three of the five men stayed upon arrival in Pakistan two weeks ago.
Senior Karachi police official Ghulam Nabi Memon said a mobile telephone and five bags had been recovered in the raid, although nothing significant was found in the bags.