Media playback is unsupported on your device Media caption 'The head of US intelligence has to be non-partisan', warns former CIA operative.

US President Donald Trump has withdrawn his choice for director of national intelligence amid criticism that the Texas congressman was under-qualified.

Mr Trump tweeted that he told Texas Republican John Ratcliffe that the nomination process would be "miserable" for him due to unfair media coverage.

Mr Ratcliffe thanked Mr Trump and said he did not want the job to become "a purely political and partisan issue".

Critics have accused Mr Ratcliffe of padding his intelligence credentials.

Skip Twitter post by @realDonaldTrump Our great Republican Congressman John Ratcliffe is being treated very unfairly by the LameStream Media. Rather than going through months of slander and libel, I explained to John how miserable it would be for him and his family to deal with these people.... — Donald J. Trump (@realDonaldTrump) August 2, 2019 Report

Skip Twitter post 2 by @realDonaldTrump ....John has therefore decided to stay in Congress where he has done such an outstanding job representing the people of Texas, and our Country. I will be announcing my nomination for DNI shortly. — Donald J. Trump (@realDonaldTrump) August 2, 2019 Report

Speaking to reporters outside the White House on Friday, Mr Trump said Mr Ratcliffe was "treated very badly, very harshly by the press" and that he believes Mr Ratcliffe "made the right decision".

Media playback is unsupported on your device Media caption Trump: 'Ratcliffe was treated unfairly by press'

But he added the media was "part of the vetting process" for nominees, and told reporters, "a lot of times you do a very good job".

"I give out a name to the press and they vet for me," Mr Trump went on to say. "We save a lot of money that way. But in the case of John, I believe he was being treated very harshly and unfairly."

Mr Ratcliffe was appointed by Mr Trump days after his aggressive questioning of former-Special Counsel Robert Mueller, the ex-FBI director who led an inquiry into alleged Russian meddling in the 2016 presidential election.

Last Tuesday, after Mr Ratcliffe was picked, Mr Trump defended him as the best man to control US intelligence agencies - a frequent target of criticism by Mr Trump.

"We need somebody strong that can really rein it in, because as I think you've all learned, the intelligence agencies have run amok," Mr Trump said. "They run amok."

The Director of National Intelligence (DNI) is appointed by the president and must be confirmed by the US Senate.

The position was created in the wake of the 11 September 2001 terror attacks. The DNI oversees the 16 civilian and military agencies that make up the US intelligence community.

Why was it withdrawn?

Analysis by Anthony Zurcher, North America reporter

Donald Trump never has been one to back away from a fight with the press. Yet here he is, publicly telling his selection for director of national intelligence that the appointment is not worth enduring the "slander and libel" of the "LameStream Media".

Perhaps the president has had a change of view. More probable, however, is that John Ratcliffe's chances of being successfully confirmed by the US Senate were diminishing by the day.

The drumbeat of negative information about Mr Ratcliffe's credentials-inflation was only exacerbating existing Senate concerns about his qualifications for the intelligence post. Some prominent Republicans were signalling reluctance to support the president's choice.

It wouldn't take too many Republican defections to sink Mr Ratcliffe's nomination if it came to a vote.

This is far from the first time the president has seen a political appointment founder - either before or after confirmation - because of insufficient vetting or objections from unexpected sources.

At this point in his presidency it seems unlikely that Mr Trump will back away from his nominate-from-the-hip style of personnel selection, but it's also clear at this point that such an approach comes at a price.

Has the job become political?

Analysis by Tara McKelvey, White House reporter

The director of national intelligence oversees a sprawling constellation of agencies, a group that includes the Central Intelligence Agency (CIA), the National Security Agency and more than a dozen others, and the position is - usually - apolitical.

Intelligence work is supposed to be nonpartisan: objectivity is "close to holy writ" for those at the CIA and the other agencies, says Richard Betts, the author of Enemies of Intelligence.

Case in point: Dan Coats, who is stepping down as director, is a Republican but managed to stay above the fray until Trump entered the picture.

Trump wanted to replace Coats with John Ratcliffe, a congressman who is seen as a Trump loyalist. Now Trump is looking for someone new, and people in the intelligence community are worried.

They pride themselves on delivering straightforward reports - not partisan views.

But if the new director is a Trump loyalist, the kind the president seems to want, the analysts will face a more complicated world, one in which being apolitical will become even harder.