The cabinet, at its weekly meeting on Thursday had recommended a presidential pardon for Khan who has been blamed for leaking sensitive weapons secrets to Iran, Libya and North Korea.
Addressing a news conference after his decision, Musharraf said Pakistan would not allow international supervision of its nuclear programme.
"There is a written mercy appeal from his side and there is a written pardon from my side," Musharraf told reporters in reference to the scientist who made a dramatic televised confession to nuclear proliferation on Wednesday.
Musharraf also said Pakistan would not hand over any documents to the International Atomic Energy Agency, submit to an independent inquiry or allow the United Nations to supervise Pakistan's nuclear programme.
Khan's stunning personal confession also absolved the government from any involvement in one of the largest nuclear proliferation scandals in history.
Few believe that Khan could have acted alone, but a deal appears to have been brokered to spare the powerful military embarrassing scrutiny over any role it may have had in the leaks.
Meanwhile, four scientists and three administrators from Pakistan's main nuclear facility have been detained after a probe into the illegal transfer of technology to other countries, our correspondent reported.
Interior Ministry spokesman Rauf Chaudhry confirmed the detention of five in Islamabad on Thursday. The detention will stretch over three months.
Musharraf met Khan before the
"They include nuclear scientists and administrators belonging to the Khan Research Laboratories (KRL)," he said.
They were detained under Pakistan's security law, he added.
However, former KRL chief Abd al-Qadir Khan, known as the father of Pakistan's nuclear bomb, was not among those in detention, Chaudhry said.
Across the country, Islamist groups have carried out protests against what they see as humiliating treatment meted out to the country's nuclear scientists, added our correspondent.
Earlier, in his confession, Khan admitted to proliferating nuclear technology and begged for the nation's forgiveness.
The founder of Pakistan's nuclear programme, who is revered as a national hero, read out his confession on state-run television soon after meeting President Pervez Musharraf.
His dramatic confession followed the questioning of more than a dozen nuclear scientists, engineers and administrators during a probe into leaks of Pakistan's nuclear knowhow.
The investigation was prompted by information from Iran via the UN's International Atomic Energy Agency (IAEA) that was forwarded to Pakistan in November.
Khan was sacked as a government science advisor last week after a two month investigation into the leaking of nuclear secrets to Iran, Libya and North Korea.