By Randy Fabi

ISLAMABAD (Reuters) - Pakistan's army chief warned on Monday, in a veiled challenge to the Supreme Court, that any efforts to undermine the military and "draw a wedge" between it and its citizens would not be tolerated.

Chief Supreme Court Judge Iftikhar Chaudhry ruled last month that the military must stop interfering in politics, a rare challenge to Pakistan's powerful generals.

The ruling has stoked tensions between the court and the military, which has ruled Pakistan for more than half of its 65-year history through coups or from behind the scenes.

"Any effort which wittingly or unwittingly draws a wedge between the people and Armed Forces of Pakistan undermines the larger national interest," said General Ashfaq Kayani, in a rare public statement that did not specifically mention the court or its judges.

An army official, who wished not to be named because of the sensitivity of the matter, confirmed that Kayani was responding in part to the Supreme Court judgment.

The October court ruling came in connection with a case dating back to 1996 in which a retired air marshal filed a petition against the army for sponsoring a political alliance.

The Supreme Court has asked the federal government to take necessary steps under the constitution against retired generals named in the case. However, Pakistan's government has little sway over generals in the military, which is one of the biggest in the world.

"While individual mistakes might have been made by all of us in the country, these should be left to the due process of law," Kayani said.

"Let us not pre-judge anyone, be it civilian or a military person, and extend it, unnecessarily, to undermine respective institutions."

The long-running standoff between the judiciary and the U.S.-backed government has fuelled instability in Pakistan, a nuclear-armed country with a fragile economy that has been battered by a Taliban insurgency.

In the late 1980s, Pakistan's military Inter-Services Intelligence agency (ISI) was accused of establishing a political cell that worked with the presidency to distribute money to selected politicians in a bid to get them elected.

(Additional reporting by Mehreen Zahra-Malik; Editing by Kevin Liffey)