"Both the army and the judiciary are pro-democracy and I am confident that they do not want the derailment of the system, as it takes years to put the system back on the rails," Gilani told the media on Saturday evening during an event at the prime minister's house.
His remarks came against the backdrop of differing stands adopted by the government and army over a move by the Supreme Court to probe a secret memo sent to the United States military seeking its help to prevent a feared coup in Pakistan.
The government has asked the apex court to dismiss petitions demanding a probe into the scandal, but army chief Gen Ashfaq Parvez Kayani and Inter-Services Intelligence head Lt Gen Ahmed Shuja Pasha have said the matter should be investigated by the court, as national security issues were involved.
The government has also challenged the court's jurisdiction to hear the case at a time when the scandal is being probed by a parliamentary panel.
Asked about the replies submitted to the Supreme Court by the army and ISI chiefs, Gilani said they were both working under the ambit of the government and their responses were routed through the Defence Ministry and the office of the Attorney General according to procedure.
Replying to another query about the government's point of view on the apex court's jurisdiction in the memogate case, he said this was a legal matter that has to be resolved in court. "We are not running (away from the memo issue). We are also concerned about national security."
Is 'memogate' a golden opportunity for Pak army?
Memogate: Could it affect Indo-Pak relations
'Memogate' a conspiracy against Pak army: Kayani
Dismiss petitions seeking memogate probe: Pak govt to SC
Gilani hints at Memogate conspiracy by lawmaker