A recent $4.2 million settlement between the Department of Labor and a Maryland county school system over its failure to pay visa fees for foreign teachers underscores the difficulty some districts are having meeting complex federal rules that govern teacher hiring.

The Prince George's County school system last week reached an agreement with the Labor Department to pay $4.2 million to more than 1,000 foreign teachers, to compensate them for work visa fees which -- under federal law -- the school system was supposed to pay. The school system will also pay a $100,000 penalty, presuming the deal is approved by an administrative judge.

According to the Labor Department, employers like the Prince George's school system must pay work visa fees in order to ensure foreign teachers are paid at least the same "wage rates" as other U.S. workers. By not paying those fees, the department claims, the system "illegally reduced the wages" of the foreign workers. The apparent goal is to make sure the wages of U.S. workers aren't depressed as a result.

"The Labor Department has the responsibility for ensuring that employers who use the H-1B program follow the law and do not place U.S. workers at a disadvantage to H-1B workers," Labor Secretary Hilda Solis said in a statement.

But the resolution of the Maryland case shines a light on the tricky spot school systems across the country find themselves.

For years, school systems have been scrambling to recruit qualified teachers, sometimes looking overseas to meet the requirements of No Child Left Behind, which states that K-12 teachers in "core academic subjects" had to be "highly qualified."

In so doing, some have shirked their obligation under federal labor law to front those visa fees. Yet, in the case of Prince George's County, to actually comply with labor law may be too costly.

"The reality is in meeting those requirements of one federal agency we got in trouble with another federal agency," one Prince George's County schools official told FoxNews.com on background.

As a result of the settlement, Prince George's will be barred from recruiting foreign teachers and extending their visas for two years. In the near-term, that means 161 foreign teachers will be forced out of the school system in the next two months due to expired visas, with another 100 following close behind by the beginning of 2012.

In the long-term, the county likely cannot afford to continue hiring teachers from overseas. It typically costs several thousand dollars to sponsor a foreign teacher -- costs that add up when jurisdictions are hiring hundreds of teachers from overseas.

"Obviously, this is not the outcome we had hoped for as these employees have provided an exceptional service to our school district," the county school system said in a statement. "However, in the final analysis of the current state of our shrinking school budget and mounting legal fees, we determined that we simply could not afford to continue to operate this program."

Fortunately for Prince George's, the pool of available recruits in the U.S. is no longer as shallow as it was when the unemployment rate was lower and the county started looking overseas.

"Now you can actually fill those vacancies with American teachers," the county schools official said. "That's the only good thing that will come out of this."

It's unclear what might happen if, when the economy bounces back, the system faces another domestic teacher shortage. Prince George's is not the only district to run into problems.

In Baltimore, the city school system plans to reimburse any foreign teachers who ended up paying their own work visa fees. According to The Baltimore Sun, a number of Filipino teachers were brought into the system after paying their own immigration costs to employment firms in the Philippines.

Baltimore schools spokeswoman Edie Foster told FoxNews.com the school system is still reviewing its records to determine how much to pay but is committed to complying with the law. Like Prince George's, Baltimore recently has received more than enough applications from U.S. teachers -- meaning, for the time being, the city is not looking overseas for recruits.

In Louisiana, the American Federation of Teachers and other groups last year also filed suit on behalf of hundreds of Filipino teachers. The suit alleged that the recruitment firms charged them exorbitant fees and that, on top of that, the recruits were not informed that the school districts were supposed to pay visa-related charges. The suit named the East Baton Rouge Public School System along with the recruitment firms.

According to the AFT, the number of foreign teachers brought into the U.S. between 2002 and 2006 climbed from 15,000 to more than 19,000.

In Prince George's, the school system claims it did not intentionally violate federal requirements to front the visa fees. The system claimed a combination of factors were to blame -- that it was late in realizing the requirement, that some teachers paid their fees directly to an employment firm, and that some teachers paid the fees up front and were reimbursed later.