Barack Obama, unlike George Bush who wanted to be in bed before 10pm, likes to work late. But even by his standards Wednesday was out of the ordinary, sitting up in a largely empty White House until 2.30am as he edited a speech an adviser later described as one of the most important of his life.

He was still nervous about it when he rose to deliver it eight hours later. Normally Mr Cool, he fluffed his opening, referring to the defence secretary, Robert Gates, as Bill, the Microsoft founder.

Part of the explanation for the bout of jitters is that Obama is struggling to contain an ever-growing row over the future of Guantánamo Bay and the security apparatus created by the Bush administration as part of its "war on terror". But there is another factor: the return of an opponent the Democrats had thought of as politically dead: Dick Cheney. The sinister, reclusive figure at the heart of the Bush administration, who attracted labels such as Darth Vader and Dr Strangelove, has returned to the heart of Washington and is causing havoc.

Obama and Cheney were billed to speak at roughly the same time, though at different Washington venues. The US media described it as the political equivalent of Ali v Frazier.

It was all a long way from 20 January when Cheney had left the White House a seeming broken man ready for retirement. The Republicans were in disarray, still coming to terms with the election losses in November. The policies with which Cheney had been associated, chiefly the invasion of Iraq, had long been discredited. And Cheney himself, as Obama prepared to take over the White House, was in a wheelchair, having put his back out lifting a box in preparation for the removal van.

The next day, back home in Wyoming, the state senate passed a resolution wishing him and his wife a happy retirement in which they could "lay their heavy burdens down and fish and write to their hearts' content". That resolution, along with the hopes of all those Democrats who thought that they had seen the last of him, proved premature.

He has forced Obama on the defensive for the first time since becoming president, giving demoralised Republicans something finally to cheer about.

"Cheney is seriously the only person who's got the White House to change its policy," Dan Senor, a foreign policy adviser in the Bush administration, told the Washington Post

Cheney has rattled Obama over the proposed closure of Guantánamo and the CIA's use of waterboarding. And not only Obama, but the next most prominent Democrat after him, the House speaker, Nancy Pelosi, who on Friday refused to answer any more questions about whether she had been briefed by the CIA about torture six years ago. She denies she was: the CIA says it did.

Obama had been planning to release thousands of pictures showing abuse at US detention centres round the world by the end of the month, but has since decided against. On the campaign trail, he denounced the Bush administration's use of military commissions to try Guantánamo detainees, but has now decided to keep them. He denounced the indefinite detention of people without trial, but is now going to do the same.

Republicans have been applauding. "I would have originally said that Cheney on torture would have been a net negative for the modern Republican party, which is working to put Bush and Cheney behind us," said Grover Norquist, an influential figure in shaping US conservatism over the past two decades. "It has worked out well for the Republicans. Cheney is looking good."

The conservative Weekly Standard is also cheering. Another influential conservative, William Kristol, writing in the current issue, said: "While most senior Bush alumni were in hiding, Dick Cheney - Darth Vader himself, Mr Unpopularity, the last guy you'd supposedly want out there making the case - stepped on to the field. He's made himself the Most Valuable Republican of the first four months of the Obama administration."

Cheney's return has enthralled the liberal media. Maureen Dowd, the acerbic New York Times writer, used her column on Wednesday for a mocking piece under the headline "Cheney grabs a third term", suggesting that he was manipulating Obama from the sidelines. In a dig at Cheney's newfound public face, popping up in television interview after television interview, she described him as "tawny with TV make-up; there's no point taking it off. The gigs are nonstop."

Obama had been scheduled to deliver his speech at 10.10am on Thursday at the National Archives, against the backdrop of original copies of the Declaration of Independence and the US constitution. Cheney was speaking at 10.30 at the American Enterprise Institute (AEI), the Washington thinktank that is home to neoconservatives. Such was the interest generated that Cheney delayed his speech until Obama, who started late, had finished. Both speeches, each of about 40 minutes, were shown live.

Cheney's speech had been in the diary before Obama's and AEI officials suggested that the White House had arranged Obama's for the same day. Robert Gibbs, the White House press spokesman, denied this, but acknowledged they had been aware that Cheney's speech was in the diary. Gibbs said on Friday: "I think the president - in terms of yesterday's speeches side by side - I think the president is not going to shy away from the debate on these issues."

Obama and Cheney provided the debate the US should have had after 9/11. Obama argued that US national security is best protected by respect for international law, by closing Guantánamo and being as transparent as possible. Cheney countered it was not as easy as that to close Guantánamo and that transparency - releasing internal Bush administration memos about interrogation techniques - had demoralised the CIA. By calling waterboarding torture, Cheney said Obama has criminalised honourable people working in good faith and has made America less safe.

Michael Barone, a conservative and author of The Almanac of American Politics, who was in the audience for Cheney's speech, said he was impressed by the vice-president: "There was a refreshing lack of ambiguity. He made his case. He sees Obama as a danger to the American people."

The irony of Cheney's publicity burst is that, throughout his eight years in office, he was a reclusive vice-president, seldom out and about in Washington, even refusing to release details to the press of his daily schedule. Even as defence secretary in the 1990-91 Gulf war, unlike his protégé Donald Rumsfeld during the 2003 invasion, he was rarely in front of the cameras.

Why has he come out now? His friends say that he had been settling happily into retirement. Although Wyoming is his home state, he lives in McLean, Virginia, in part to be close to his grandchildren. From an office in McLean, he has been working on his memoirs, much of which are devoted to his part in the US response to 9/11 and the subsequent opening of Guantánamo and the invasion of Iraq. Obama joked earlier this month the memoirs should be called How to Shoot Friends and Interrogate People

Mary Matalin, Cheney's spokeswoman in the early years of his vice-presidency, told the Washington Post last week that he would have remained in retirement, but was incensed by Obama's criticism of Bush and him for setting up Guantánamo.

"If Barack Obama had come in and done what he said he was going to do and look at the stuff and see what is working, then Cheney would have continued to do what he was doing - working on memoirs, finishing his house," she said. "He's got a good life. He's got stuff going on. He doesn't care about being on TV. There's no more politics there. He's not settling any scores. He just wants people to understand."

Aged 68, Cheney has been in politics most of his adult life, serving six terms in Congress. He left politics for a five-year tenure as chairman of Halliburton - the oilfield service company that was to be one of the principal beneficiaries of the Iraq war - before returning as vice-president under Bush in 2001.

He went on to become the most powerful V-P in US history, partly because of Bush's lack of foreign policy experience. The attacks on New York and Washington in their first year in office saw Bush, pushed by Cheney, embrace an aggressive, ideologically driven approach to the world.

Cheney, supported by Rumsfeld, the defence secretary, and by neoconservatives including the deputy defence secretary, Paul Wolfowitz, were behind Afghanistan, Guantánamo, the secret CIA camps round the world and the invasion of Iraq.

In his speech on Thursday, Cheney offered the best insight yet as to why he reacted as he did to 9/11. "I was in my office in that first hour when radar caught sight of an airliner heading towards the White House at 500mph. That was Flight 77, the one that ended up hitting the Pentagon. With the plane still inbound, Secret Service agents came into my office and said we had to leave now. A few moments later, I found myself in a fortified White House command post somewhere down below.

"I've heard occasional speculation that I'm a different man after 9/11. I wouldn't say that. But I'll freely admit that watching a co-ordinated, devastating attack on our country from an underground bunker at the White House can affect how you view your responsibilities." The two had 2,689 days left in office but "on our watch, they never hit this country again".

In the second term, with Iraq going badly, Bush was less in thrall to Cheney. Ignoring protests from Cheney, Bush sacked Rumsfeld and replaced him with Gates, who, together with General David Petraeus, came up with a feasible Iraq exit strategy.

Bush and Cheney fell out badly at the very end. Cheney was incensed that Bush would not use his prerogative in his final days to pardon the vice-president's former chief of staff, Lewis "Scooter" Libby, who was convicted for lying over the outing of a CIA agent. Cheney viewed Libby as a loyal servant - one who may have been covering up for someone higher up - and said a few days after losing office that Libby had been "hung out to dry".

Stephen Hayes, author of a 2007 biography of Cheney, said many people wondered why he had not made the public case for Guantánamo and Iraq while in office. Hayes, who discussed this with him during 30 hours of interviews for the book, thinks he has the answer. "I asked him: 'Why are you not out there making this case? You are making it better than George Bush.' He said: 'That is simply not my role. He [Bush] asks me for advice. If I was out there, it would not be the same."

But free from office, Cheney no longer has any such constraints, especially as Bush appears to have opted for silence, deciding that it would be undignified to criticise his successor.

Thomas Mann, a political scientist at the Brookings Institution, said: "I think Dick Cheney believes Bush will not be a forceful defender of what they did and is damned if he is not going to lead the charge. At a some time an event or another figure will overtake him, but at present there is a vacuum in the Republican party."

The party is in disarray, with no serious contender in sight to provide them with the leadership necessary for Congressional elections next year and to take on Obama in 2012. Is it possible that Cheney, in spite of poor health and poor popularity ratings, might be planning a shot at the presidency? Those who know him rule it out, citing his heart attacks and other health problems.

One of those watching Cheney on Thursday said, in response to the suggestion that he could be a contender: "Are you crazy? Have you seen him trying to work a crowd."

Cheney reinforced the point as he delivered his speech, speaking in a monotone, unsmiling, hunched over, reading his script without the benefit of an autocue. Two thirds of the way through, a room packed with sympathisers began to look for distractions, mainly their mobiles and Blackberries, with one openly reading the Wall Street Journal

The Democrats, including Obama's senior adviser, David Axelrod, argue that having Cheney in such a high-profile role is helpful for them, because he is reminding voters of one of the most disliked administrations in US history. Cheney has high unpopularity ratings, hovering around 60%. The Democrats regard his present prominence as a short-term phenomenon.

Obama's problems, though, are set to last much longer. He is struggling to find a way out of what he describes as the "legal mess" he inherited from Bush and Cheney. The left expressed disappointment that he first agreed to release thousands of pictures of abuse at US detention centres round the world and then refused. Cheney's supporters credit him with the about-turn. The left is unhappy, too, that Obama is to stick with tainted Bush-Cheney policies: the use of military commissions to try some Guantánamo detainees and keeping others in prison indefinitely without trial.

Democrats in Congress, too, are at odds with Obama. They are blocking the transfer of detainees to their states and on Wednesday the Senate voted to refuse Obama the $80m he needs to close the detention centre until he comes up with a detailed plan.

Hayes believes that Cheney, while not enjoying the limelight, is not about to depart the scene any time soon. As long as he is working on his memoirs, the events surrounding Guantánamo will be fresh on his mind and he will be willing to answer questions about them.

Norquist, though cheered by his unexpected return, is among those Republicans hoping he will not hang around too long. A conservative who advocates lower taxation but parts company with Cheney over torture, he said: "Cheney has put Obama on the defensive. He should declare victory and retire from the field."

Dick Cheney: in his own words

2003

"We know he [Saddam Hussein] has been absolutely devoted to trying to acquire nuclear weapons, and we believe he has, in fact, reconstituted nuclear weapons."

"My belief is we will, in fact, be greeted as liberators [in Iraq]."

2004

"Direct threats require decisive action, act with all the urgency that this danger demands. We must be prepared to face our responsibilities and be willing to use force if necessary. The days of looking the other way while despotic regimes trample human rights, rob their nations' wealth, and then excuse their failings by feeding their people a steady diet of anti-western hatred are over."

"Go f*ck yourself." (Overheard while Cheney was speaking to a Democratic senator in a row over his old company, Halliburton.)

22 May 2009

"I was and remain a strong proponent of our enhanced interrogation programme. The interrogations were used on hardened terrorists after other efforts failed. They were legal, essential, justified and the right thing to do."

"The [Obama] administration has found that it's easy to receive applause in Europe for closing Guantánamo. But it's tricky to come up with an alternative that will serve the interests of justice and America's national security."