IT WAS a sign of how bad Democratic expectations were for the Senate race in Massachusetts that the knives were out even before the polls had closed. The election, in a state where Democrats heavily outnumber Republicans (and independents account for around half of the electorate), was held to replace Ted Kennedy, a Democratic stalwart who died last year. Mr Kennedy's last legislative priority had been to push for a health-care bill. Now Scott Brown, a Republican former model, will replace him, having won by a five-point margin. This gives the Republicans 41 seats in the Senate, enough for a filibuster to block legislation.

Martha Coakley, the Democratic candidate, was uninspired and dull. Mr Brown's surge in the polls came when she was on holiday, believing there was little chance she could lose. She made several gaffes on the campaign, at one point implying that she had better things to do than meeting voters in the cold, later failing to recognise a legendary pitcher for the local Boston Red Sox baseball team. Her lacklustre style, against an energetic Mr Brown, failed to impress a grumpy electorate in an anti-incumbent mood.

The election is an extremely serious blow to the agenda of Barack Obama. He made a late swing through Massachusetts to stump for Ms Coakley, but failed to help. His ability to pull Democrats out of the fires of voter anger is now in question. The White House blames Ms Coakley. Mr Obama's most senior political adviser, David Axelrod, said even before election day had ended, somewhat testily, that the White House had done everything that the Coakley campaign had asked.

Now the fate of the health-care bill is in doubt. Mr Brown opposes the federal bill, although he supported a similar one in Massachusetts, a law now in effect that (like the federal bill) requires individuals to buy insurance. Mr Brown says that different conditions apply in different states and the federal bill will cost too much. As the other Republicans are united in opposition to the bill, they would have enough votes to block it.

That is, however, only if it returns to the chamber. The Senate has already passed one version of the bill. The House of Representatives has passed another one with a more left-wing bent, including a public-insurance programme. Democrats are now hoping to press the House merely to pass the Senate's version of the legislation. This would go down badly with many of the House's more left-wing Democrats. But the alternative, it seems, is no bill or a far weaker one.

If health-care reform still has a chance of passing in some form, two other big domestic measures seem in greater doubt. One version of a cap-and-trade bill for limiting emissions of greenhouse gases passed the House last year and another is making its way through the Senate. But it is unpopular among voters, especially in the downturn. A mooted immigration reform that would regularise the status of millions who are in America illegally has even less chance of passage in a country feeling grouchy and vulnerable.

Days before the election some Democrats were saying that their party needed a slap to get its fighting spirit up. Republicans may not cruise to big victories in November's mid-term elections simply by filibustering everything the president sends to the Senate in the next ten months, but the win in Massachusetts is a big boost for the party. Mr Obama remains reasonably well liked—his job-approval ratings hover at around 50%. But many Obama supporters voted for Mr Brown, which bodes ill for the Democrats in November.