By Nick Assinder
Political correspondent, BBC News website
All three of the big party leaders had much riding on the outcome of the first by-elections since Gordon Brown became prime minister three weeks ago.
And, as results in Sedgefield and Ealing Southall came in it was clear Mr Brown could breathe easy, the Liberal Democrats' Sir Menzies Campbell would live to fight another day, while Tory leader David Cameron would wish he had managed a better showing to underpin his party's longed-for revival.
Mr Brown wants his "bounce" to continue
Labour should never have been in any danger of losing either of these rock-solid seats, but the contest was a major early test of Mr Brown's premiership and whether the so-called "Brown bounce" was continuing.
As the leader of a mid-term government, the prime minister would normally have braced himself for a bit of a kicking from the electorate.
The Labour vote certainly dropped in both seats, but Mr Brown will be hugely relieved that his candidates held on with very respectable majorities.
And he will see these results as a sign that his approach is paying dividends and that the government is indeed benefiting from the change in leadership.
Sir Menzies probably had the most to lose from these contests and he invested a great deal personally in the campaign, with eight visits.
His leadership continues to attract criticism and he needed a good showing to head off a possible threat to his future.
By pushing the Tories into third place in Sedgefield and holding on to second place in Ealing Southall he has probably headed off the worst - at least in the short term - if not pulling off any sensational outcome.
Sir Menzies would have dearly loved to win in the London seat with another of those famous third-party shocks or, failing that, give Labour a closer run for its money.
That didn't happen, but neither did his candidate lose out to the Conservatives, as some had feared.
David Cameron has least to celebrate as a result of these contests.
His failure to hold on to second place in Sedgefield will have come as a disappointment, but the Tory share of the vote held up so the performance was not the disaster his opponents were claiming.
Probably worse was the result in Ealing Southall. Again, the party's vote held up but it failed to overtake the Lib Dems and win the second place which many had been hoping for.
The outcome will contribute to the mutterings over the direction Mr Cameron is taking the Conservatives and provide some ammunition for those in the party who believe they simply are not making the sort of advances needed to put them on the road to victory at the next general election.
Mr Cameron has recently suffered from the row over grammar schools and the good opinion poll showings for Mr Brown since he became prime minister and would have liked a better result to help draw a line under all that.
His campaign started well with the defection of five Ealing Labour councillors to the party.
But it suffered an embarrassing setback when it emerged candidate Tony Lit's radio company had made a donation to Labour and he had been photographed with Mr Blair only days before his selection.
That saw Mr Cameron's team losing much of its initial optimism. And, as it turned out, that early promise was not fulfilled.
However, the result was short of a disaster and Mr Cameron should be able to weather it.