The president, whose country is in the front line in the war on al-Qaeda, told them that the way to fight terrorism was not to kill terrorists. Like leaves on a tree they would grow again, and even if a big branch like al-Qaeda was chopped off, "the tree remains". The answer was to address economic deprivation and ignorance.
President Musharraf outlined to the Edinburgh pupils his educational strategy of enlightened moderation, rejecting extremism is all forms.
Teacher training, new textbooks and a mainstream curriculum were his priorities.
The pupils were on a 10-day trip to Pakistan after winning a competition funded by Humayun Mughal, a Pakistani-born businessman who founded Akhter Computers in Essex.
One pupil asked Mr Musharraf how two assassination attempts last December had changed his life. "I used to be quite independent, going to hotels after dinner for hot chocolate. But my security people are not happy about that now," he said.