It was Iran in 2003, which started the western propaganda against Pakistan and its scientist Abdul Qadeer Khan, when US occupied Iraq, Iran freaked out and in order to protect their nuclear program they gave access to IAEA and disclosed Pakistan's support in establishing uranium enrichment facility, the rest is history a pakistani hero was made a villain, Pakistan's image was damaged just because some shia-sympathizer Pak general wanted Pak scientists to help Iran develop nuclear weapons and in return Iran showed its true colors.
https://www.shiachat.com/forum/topic/234974077-how-iran-stabbed-pakistan-in-the-back/
the real question is whether Pakistan sold the technology to Iran. One reason not to sell nuclear technology is avoid getting exposed