By Nick Assinder
BBC News Online political correspondent
If Tony Blair wanted to end the parliamentary session with a defiant show of strength he could not have chosen a better way of doing it than by giving Peter Mandelson a job.
Mandelson: Wanted a cabinet job
By bringing the twice disgraced, widely disliked ex-minister in from the cold he has sent out the clearest possible message that he is still the boss and can do pretty much whatever he likes.
His choice of European Commissioner will not only prove controversial with voters - which will now be tested with a losable by-election in Hartlepool.
But it flies in the face of major cabinet opposition - maybe even the majority of the cabinet.
His cabinet opponents will at least be heaving a sigh of relief that he has not been brought back into the top team and will be unable to get deeply involved in domestic politics.
But even that was, apparently, touch and go.
It is widely rumoured that Mr Mandelson had initially hesitated when the prime minister offered him the Brussels job and argued for a cabinet post.
It is virtually certain he would have preferred to be in the front line of British politics, and with a big role in the next general election campaign.
And he probably still believed he had a future in domestic politics and may even think he can make that transition at some time in the future.
But when it came to decision time, the prime minister probably felt it was a move too far to bring him into the top team because it would have sparked a near revolution in the cabinet.
But he wobbled.
Support and affection
And it has to be said there are some in Westminster who believe the rumours of a cabinet job were a bit of Mandelson-style spin design to lessen opposition to the Brussels job. - the lesser of two evils scenario.
What seems certain is the prime minister still retains huge support and affection for his best friend and felt he treated him harshly over his second sacking.
He appears to believe he still owed him for that and was ready to weather the wrath of Mr Mandelson's many enemies.
Gordon Brown and his supporters did not want to see Mr Mandelson back in the cabinet and may comfort themselves with the thought he is now out of domestic politics for at least five years.
But that relief will be tinged with irritation that he has not simply been left on the backbenches.
Meanwhile, the prime minister may have accepted that the appointment means Labour could well lose the Hartlepool seat, even though it bucked the national trend in recent local elections and increased the Labour vote.
It was suggested at the time that that was because Labour poured resources into the seat as a dry run for a by-election some time in the autumn.
There will now be a great debate over precisely why Mr Blair felt it necessary to bring Mr Mandelson back at all - and what affect the appointment will have on the referendum on the EU constitution and Britain's relations with Europe more generally.
On the first, no one doubts the closeness and depth of the relationship between Mr Blair and Mr Mandelson.
But, in politics, that does not always count for much, particularly if it is the source of controversy.
And this will cause huge controversy with any number of cabinet ministers - in private if not in public - expressing their dismay and disbelief that Mr Blair is ready to risk accusations of lack of judgement and being out of touch with his party in order to support his friend.
On the issue of relations with the EU and the referendum, the prime minister must be hoping that by appointing a fierce pro-European to the job he will improve relations with other countries and send out a clear signal of his intentions towards Europe.
Mr Mandelson's critics, however, have already claimed the appointment will lose Labour millions of votes in that referendum.
And the first challenge he will face will be a vote by the European parliament on the appointment of the new Commission.
If Euro MPs don't like the look of Mr Mandelson, they can veto the appointment - but that would mean rejecting the entire Commission.