Downing Street secretly hired a US law firm to advise on how much trouble Bill Clinton was in over the Monica Lewinsky affair ahead of Tony Blair’s first visit to the White House.

The PM flew to Washington in February 1998 at the height of special prosecutor Kenneth Starr’s wide-ranging investigation into the conduct of Mr Clinton and his wife Hillary.

Mr Blair earned the thanks of the Clinton administration after using a joint press conference to declare his support for the embattled US president.

But National Archives files show that behind the scenes in No 10 worried Mr Blair could be damaged by association.

Jonathan Powell, the PM’s chief of staff, took the precaution of hiring a Washington law firm, Sutherland, Asbill and Brennan LLP, to advise on the president’s legal predicament, and whether he might be charged with perjury when he denied having sexual relations with intern Ms Lewinsky.

Despite warnings about Mr Starr's determination to "get something on" Mr Clinton, Mr Blair publicly called him “someone I can trust, someone I can rely upon, someone I am proud to call not just a colleague but a friend”.

British ambassador Sir Christopher Meyer said the public show of support had created “a lot of British credit in the American bank”. 

He reported to the UK: "The tension shown by Clinton and his staff before the press conference was only matched by their relief afterwards.

“Clinton was at his Houdini best. The Prime Minister was firm in his support for Clinton.

“There is criticism in the UK that Mr Blair has put too many eggs in Clinton’s basket. But this misses the point. The White House… and even the Republicans will have noted with approval that the Prime Minister has stayed loyal to a friend in trouble.”