You receive 4 credits each year you worked. If you have already accumulated 36 credits by working 9 years, you may pay in the Social Security(SS) tax yourself as self-employed for one year to get the needed 4 credits when you no longer work for the government. I think you only need to pay a minimum of several hundred dollars to get each credit. It is worth it.
If you qualify for both SS benefit and government pension when you retire, your pension will be off-set by certain amount. See:
http://www.ssa.gov/pubs/10007.html#a0=1
Payment of SS tax as self-employed: