The court in Abbotabad awarded the sentence to Tehrik-e- Taliban Pakistan terrorists - Qari Shafique and Qair Altaf.
Shafique was arrested last year from Balakot during a search operation and 32 kilogram explosives were recovered from him.
Altaf fled during the search operation. However, he was later arrested from Balakot and presented before the court after six months of Shafique's arrest.
The two terrorists were accused of planning to blow up Shia Imambargah at Khait Sarash in Mansehra district.