Washington (CNN) -- President Barack Obama on Tuesday signed into law a $26 billion measure to help avoid teacher layoffs -- a move Democrats claim is necessary in the wake of state and local government cutbacks.

The House gave final approval earlier Tuesday to the bill, which had already passed the Senate.

The measure, which passed the House on a largely party-line 247-to-161 vote, is designed to save the jobs of approximately 160,000 teachers across the country, as well as create and save positions for police officers, firefighters and nurses, according to Democratic leaders.

Specifically, it includes $10 billion for teacher positions and $16 billion to help cover state Medicaid payments.

Republican leaders have blasted the bill as an irresponsible union giveaway that will impede prospects for a long-term economic recovery.

The House began its summer break at the end of July and was not expected to return until mid-September. But House Speaker Nancy Pelosi called members back into session after the Senate unexpectedly passed the state assistance bill last week, after the House had adjourned.

Pelosi declared Tuesday that the bill was not only about stabilizing state budgets, but also about "the education of our children" and "innovation in our nation."

"We can't stand by and do nothing while pink slips are given to the men and women who educate our children," Obama said at the White House on Tuesday morning.

Teacher layoffs, he said, "Should not be a Democratic problem or a Republican problem. It's an American problem."