The decision was taken at a marathon meeting yesterday of mainstream political parties chaired by Prime Minister Nawaz Sharif who said the move would help ensure "terrorists pay the price" for their "heinous acts".
The meeting, which lasted for nearly 11 hours, was called to formulate a plan to deal with militancy after the Taliban attack on the army school in Peshawar on December 16.
A government official said that the leaders agreed to set up special military courts for two years with a clear mandate to try the cases of militants.
After the meeting, PPP leader Khursheed Shah told media that constitution would be amended to create military courts for limited period.
Among others, the meeting was attended by leaders of Pakistan Thereek-i-Insaf party, Pakistan Muslim League-Quaid, Qaumi Watan Party, Balochistan National Party and some smaller groups.