Peter Mandelson, according to his friends, stood outside Tony Blair's office yesterday uncertain what lay behind the door. He did not know whether he would be offered Northern Ireland, defence or Millbank. "It was a surprise," he told a friend later.

All the signs in the morning before his visit to Downing Street back that up. He was spotted in a Commons courtyard laden down with a briefcase, slightly dishevelled by his standards, fumbling with his mobile, hunting out a photocopier for a speech on the "knowledge economy" he was due to deliver at the Savoy last night. He was the typical backbencher.

Within hours of the announcement that he was going to Northern Ireland, his life had been turned upside down, even more so than when first appointed to the cabinet. A plane was available to take him to Belfast, a personal bodyguard was in place and the politician forced to resign last December over his extravagant mortgage in Notting Hill suddenly had three homes - a house in Hartlepool, a flat in London and a castle in Northern Ireland. And he had inherited one of the biggest and most difficult political problems facing the government: finding a way to move the peace process forward.

HumilityDowning Street said he had "paid the price for his mistake" and Mr Blair wanted him "back where he belonged". It is 10 months since Mr Mandelson resigned, making it one of the quickest comebacks in British political history.

The Tory chairman, Michael Ancram, accused Mr Blair of arrogance in bringing him back so soon. But Labour insiders offered other explanations for his speedy return: Mr Blair had not considered the initial offence all that serious; Mr Mandelson had shown the necessary humility on his resignation; the Northern Ireland job was not a bed of roses and there was a shortage of people who could do it.

Reports about Mr Mandelson's return first surfaced in June after Labour's disastrous performance in the European elections. But Mr Mandelson, 45, told friends yesterday that would have been too soon and that neither the party nor the public would have accepted it. The mood smelt different now: he had read the runes and they told him there was no longer the same level of resistance.

His two biggest foes - the chancellor, Gordon Brown, and the deputy prime minister, John Prescott - had bridled at the prospect of him being offered a post at the top of the party, running the Millbank machine, an idea floated by Mr Blair in June. But there were not the same objections to Northern Ireland. A Westminster source said: "He will be far enough away not to meddle."

One of Mr Mandelson's closest colleagues agreed that it will be better for him to be away from the London political scene. "It will take him out of the hothouse atmosphere of Westminster where the sniping and smearing he faced at the cabinet office and the DTI [the two ministerial offices Mr Mandelson held before his resignation] will be absent. He will be in a job in which everyone will want him to succeed."

Throughout the last 10 months, even though he was down, the sniping has continued. The Brownite camp - ministers and MPs, journalists and officials (and former officials) - had put Mr Mandelson in a coffin and were desperately trying to nail him down.

They confidently predicted that he could never come back and that if any attempt was made to bring him back, they had information that would stop him. There were hints of wild parties he had been seen at, further financial information that was claimed would damage him and an allegation that he had health problems. One of Mr Mandelson's closest friends, illustrating the extent of the smear campaign, said he had been called by a tabloid editor and asked to stand up a story that Mr Mandelson had discussed being admitted for depression to the Priory, a clinic popular with celebrities. "It was ludicrous," the friend said, adding it was hardly surprising he was upset at losing his cabinet post but that was different from being clinically depressed.

Mr Mandelson was in a black mood that lasted almost from Christmas to the spring but which lifted after he sold that notorious Notting Hill house. He appeared to be more cheerful, and took a renewed interest in political ideas, attending seminars and conferences, many of them abroad. A friend who spent the weekend with him said there had been nothing to suggest he was about to get a cabinet job back. "I have never seen him so happy and interested in politics. He was a different person. He had a lot more time to read. No red boxes and distractions during the day."

CampaignAt the Labour conference a fortnight ago, he was in the same mood, enjoying the round of fringe meetings. While he still spoke to Mr Blair and regularly saw Downing Street insiders such as the press officer, Alastair Campbell, and the adviser on Europe, Roger Liddle, he was not at the centre of events as he had been in the past and said his return to cabinet was neither inevitable nor imminent.

The Northern Ireland job was first raised on June 22 when the Ulster Unionist leader, David Trimble - at a lobby briefing that was supposed to be off the record but leaked out anyway - called for Mo Mowlam to be replaced by Mr Mandelson because he had the prime minister's ear.

Earlier that month, Mr Blair had told a meeting of Labour strategists at Downing Street that he wanted Mr Mandelson back at Millbank to ensure there was no repeat of the European election debacle.

That never materialised, partly because Mr Brown and Mr Prescott did not want it to happen and partly because Mr Mandelson himself did not want a return to a backroom job.

But Labour sources predict that even though he is at the Northern Ireland office, he will be back at Millbank for the general election campaign, a reunion of the team that won in 1997. Although Mr Brown and Mr Mandelson do not get on, the hope is that they can work together, as they did in the last election.

Last night, Mr Mandelson delivered his speech at the Savoy. Today, he flies with Ms Mowlam to Northern Ireland, his short spell in the wilderness over and the most important challenge of his political career ahead of him.