The incident occurred after Sharif arrived at Jamia Naeemia to address a ceremony marking the death anniversary of cleric Mufti Mohammad Hussain Naeemi, reports Dawn news.
Video footage showed Sharif visibly shocked in the immediate aftermath of the incident.
The man was immediately caught and taken into custody.
The organisers said they were trying to ascertain the identity of the attacker and how he was able to enter the hall.
(This story has not been edited by Business Standard staff and is auto-generated from a syndicated feed.)