Working for the government on the federal, state, or local level certainly has its pros and cons. On the positive side, you'll generally have good job security and competitive health and retirement benefits. However, the pay is generally not quite as good as a comparable private sector job – most people don't get rich as a public school teacher, police officer, or social worker.

Still, one of the best benefits to choosing a career in government work is so new it hasn't really even kicked in yet – student loan forgiveness. Started in 2007, the Public Service Loan Forgiveness program can literally mean tens of thousands of dollars in free money to get out of student loan debt. Here's how it works and what you need to do to qualify.

Source: flickr

What the program does
Basically, after making 120 payments on your Federal student loans while under a qualified repayment plan while working full-time for a qualifying public service organization, borrowers are eligible to have any remaining balances completely forgiven.

And, for lower-paying jobs that require advanced degrees, this amount can be quite large. For example, consider the case of a social worker with a Master's degree who graduates with $60,000 in student loan debt and earns the national average salary of about $41,500.

Well, under the Pay-As-You-Earn repayment plan (more on that later), this borrower's monthly payment would be just $200 per month, according to the repayment estimator on studentloans.gov. This isn't even enough to cover the interest on the loans. In other words, a borrower in this situation could actually see their balance remain the same, or even increase over time.

However, even if the loan balance swells to say, $70,000, it will be wiped clean after 10 years of on-time payments, provided the borrower works in a qualifying public service job.

Who qualifies?
Employment that qualifies includes most agencies that qualify as non-profit organizations. Employees of any government organization can qualify, as will any organization designated as tax-exempt under section 501(c)(3) of the Internal Revenue Code.

And, many private non-profit employers qualify, even if they don't have tax-exempt status, as long as they provide a qualified public service, like emergency management or public health services.

To meet the full-time requirement, you have to work an annual average of 30 hours per week, unless your particular job doesn't require a full year's work, like a 10-month teaching contract. And, if you work more than one public service job on a part-time basis, your hours worked can be combined to qualify as full-time.

For a more complete list of occupations that will potentially qualify for public service forgiveness, here (link opens a PDF) is a fact sheet about the program.

What repayment plan should you choose?
As far as the "qualified repayment plan" requirement goes, there are a few to choose from. The standard repayment plan counts, but is pointless under this program as you'll have your loans paid off in 10 years anyway.

The best choice for Public Service Loan Forgiveness is the best income-dependent plan you can qualify for, which currently consists of Income-Contingent Repayment (ICR), Income-Based Repayment (IBR), and Pay-As-You-Earn. Generally, one of the latter two will be the best option for you.

Pay-As-You-Earn has the best terms, but not everyone can qualify (yet). As of now, only borrowers who began taking out loans after Oct. 1, 2007, and have received at least one loan disbursement since Oct. 1, 2011, qualify, but by the end of 2015, the program will be open to all borrowers. So, if you don't qualify yet, keep an eye on this as it will be the best arrangement once it's available.

Under Pay-As-You-Earn, your payments are capped at 10% of your discretionary income. And, if for some reason you don't qualify for public service forgiveness, your remaining balance is forgiven after 20 years of payments, regardless of how much is still owed.

And, under Income-Based Repayment, payments are limited to a slightly higher 15% of your discretionary income, and are forgiven after 25 years.

In a nutshell, if you anticipate qualifying for public service loan forgiveness, you should choose the plan that produces the smallest monthly payment.

How to get started
Other than working in a qualifying job and making your payments on time, there is really nothing you need to do just yet.

However, if you want to get a head start on keeping track of your eligibility, there is an employment certification form (link opens a PDF) you and your employer can fill out and send in to verify that your employment qualifies and keep track of your progress toward forgiveness.

Now, while this isn't mandatory, bear in mind that if you don't do it, you'll need to track down your employers over the last 10 years when you eventually apply for forgiveness. This can definitely make the process smoother and easier for you.

So, depending on your personal situation, public service loan forgiveness can certainly be a big perk of your public sector job.