A military court ruled on Monday to hold 18 Palestinian lawmakers from the ruling Hamas party in prison until their trial is over.

The military prosecutor's office had appealed a court decision last week ordering the lawmakers freed on bail while the court proceedings continue.

"We shall not allow high ranking officials of a terror organization to hide behind their ranks, whatever they may be," said Major Maurice Hirsch, the army's deputy chief prosecutor in the West Bank.

One of the detainees, Aziz Dweik, speaker of the Palestinian parliament, said in response that the decision was 'political.'

Mushir al-Masri, a senior Hamas lawmaker in Gaza, said the group, whose charter calls for Israel's destruction, did not recognize the legitimacy of "Zionist courts."

Israel arrested the lawmakers, including three Cabinet ministers, in June, after Hamas-allied militants captured Israel soldier Gilad Shalit on June 25.