The upper house of parliament passed a bill proposing amendments to the Army Act on Thursday.
The bill was presented by Defence Minister Khawaja Asif and was rushed through without being referred to a committee.
The bill includes a section regarding punishment for defaming the army for two years and a fine.
The amendments also say that divulging information related to national security and national interests will lead to a prison sentence of up to five years. The person will be penalised under the Army Act and the Official Secrets Act.
The bill also said that officials that fall under the law will not be able to participate in political activities within two years of retirement, resignation or dismissal. The duration for those on sensitive posts will be five years.
In case a person commits an offence against the Army under the Prevention of Electronic Crimes Act, action will be taken against him under the act, the bill says.
At the start of proceedings, Senator Raza Rabbani said that a new bill had been tabled this very morning and should be sent to the relevant committee.
Senator Mushtaq Ahmad echoed Rabbani and said that everyone loved the army but the stature of the house should be respected.
Senators from the Pakistan Tehreek-e-Insaf as well as Raza Rabbani and Tahir Bizenjo walked out of the proceedings.