Lawmakers overwhelmingly voted in favour of extending Chief of Army Staff General Qamar Javed Bajwa's tenure by three more years.
Pakistan's parliament on Tuesday approved extending the term of the army chief for another three years despite the objections of some parties, which accuse the military of heavy-handed tactics in its anti-militant operations.
"All parties shunned their differences and stood united in the best national interest," Information Minister Firdous Ashiq Awan told reporters outside the parliament.
The two main opposition parties Pakistan Muslim League -Nawaz (PML-N) and Pakistan People's Party (PPP) have a long history of clashing with the military but nevertheless backed the legislation.
Two smaller parties and some members of parliament from the northwestern districts in the province of Khyber Pakhtunkhwa opposed it. They accuse the military of committing rights abuses during its anti-militant operations.
"This parliament's majority is fake, this prime minister is fake," said Asad Mahmood, parliamentary leader of the Jamiat Ulema-e-Islam-F religious political party, which says it unfairly lost seats in the northwest to Khan's party.
"We will not support any such amendment in the law by a fake parliament."
The legislation passed in Pakistan's lower house on Tuesday also sets a maximum age of 64 for the chiefs of the army, air force, and navy.
The bill now goes to the Senate, where it is expected to pass before being signed into law by the president.
Regardless of the fact who is the army chief and who is the prime minister, targeting national security apparatus will not serve any body's purpose. Gen Bajwa was appointed by Nawaz Sharif, havens wouldn't fall if Imran Khan has given him extension.— Khawar Ghumman (@Ghummans) January 4, 2020
Tensions with India over Kashmir
Pakistan has been ruled by the military for about half its history and tension between civilian governments and the top generals often dominates politics. Any effort by a military chief to consolidate power is viewed with suspicion.
But critics of Prime Minister Imran Khan say his government enjoys the support of the military which is why the government approved the extension for Chief of Army Staff General Qamar Javed Bajwa in August.
The government cited a worsening national security situation with old rival India –– which annexed a portion of disputed Kashmir last year, heightening regional tensions –– as justification for the extension for Bajwa at the end of the usual three-year term.
But in a surprise ruling, the Supreme Court struck down the extension in November, ordering the government and army to produce legal provisions and arguments for the reappointment, pitting the judiciary against the government and military.
The government responded by drafting legislation which the lower house of parliament approved on Tuesday, clearing the way for the extension.
We voted against the #ArmyAct before walking out. This parliament acted like a rubber stamp. Speaker didn't even allow the few dissenting voices to make their case. This is one of the darkest days in Pakistan's parliamentary history. It will take a long time to recover from this.— Mohsin Dawar (@mjdawar) January 7, 2020
The military sets defence and security policy and also dominates foreign affairs.
Recently, it has also had a role in framing economic policies.
Opposition activists and rights groups have also accused the military under Bajwa of "meddling" in politics, limiting civil liberties and "muzzling" the media.
The military denies interfering in politics or curbing freedoms.