EXACTLY two years ago, an excruciating Senate hearing nearly did for Chuck Hagel, America’s outgoing secretary of defence. Hapless, shaky on his brief and stumbling in his answers, Mr Hagel’s performance in front of the Armed Services Committee undermined his authority at the Pentagon from the start, allowing the White House an opportunity to meddle that even it eventually tired of.

It was never likely that Ashton (“Ash”) Carter’s confirmation hearing for the same job on February 4th would be a repeat of that. Many consider him supremely qualified. He has served at every level of civilian leadership at the Pentagon (most recently as its chief operating officer until 14 months ago). When out of office, Mr Carter, a physicist, has been an influential national-security scholar with a particular expertise in nuclear strategy and technology. Although a lifelong Democrat, he enjoys a rare degree of support across the aisle, even from Republican hawks such as John McCain, the committee chairman.

That did not mean that Mr Carter’s hearing was a cakewalk. Senate Republicans despise what they see as Barack Obama’s passivity in the face of mounting threats from abroad and his reluctant use of American military power to confront them. Mr Carter managed not to be disloyal to his boss while hinting at a more robust approach in the future. For example, he said he was “very much incline[d]” to send defensive weapons to Ukraine. By the end, a mood of almost cosy bipartisanship had descended. Mr Carter is expected to be confirmed easily next week.

His hearing was preceded two days earlier by the president’s 2016 budget request to Congress, which included a defence base budget of $534 billion, $35 billion more than the spending cap required by the controversial 2011 Budget Control Act, plus $51 billion for funding wars. Unless the administration can cut a deal with Congress, sequestration—automatic across-the-board cuts—will kick in, making a nonsense of Mr Obama’s request.

Mr Carter and Mr McCain agree that military spending needs to rise. They are equally exasperated by the failure to find a solution to the problem of the caps, which Mr Carter has described as “purely the collateral damage of political gridlock”.

Sadly, there is little chance of a grand bargain that would finally lift the threat of sequestration from defence. The Republicans want to pay for more of it with spending cuts elsewhere; the Democrats (and the president) want to pay for it with higher taxes or by adding to the deficit. Each approach is abhorrent to the other side.

Thus the task for Mr Carter in the slightly less than two years he has (unless Mr Obama’s successor keeps him on) is to find a way to live with a budget that is too small, while dealing with everything else. This includes bringing some coherence to the campaign against Islamic State; improving deterrence against Russia; preparing for the consequences of the talks aimed at preventing Iran from building nuclear weapons; and supporting the new government in more-or-less forgotten Afghanistan.

At the same time, he must aim to leave America’s defence establishment in better shape than he found it. This involves modernising its ageing nuclear forces and ensuring that America keeps its technological edge over potential enemies (the “offset strategy”, now mainly concerned with robotics, miniaturisation, hypersonics, cyber-warfare and the handling of “big data”). High on the wish-list of new weapons are unmanned carrier-strike aircraft and stealthy unmanned underwater vehicles that can creep close to enemy shores.

To fund new weapons and technologies, Mr Carter will need help from Congress to reform military pensions and health care, axe legacy weapons (such as the A-10 tank-busting aircraft) and close unwanted bases: all horribly hard. He will need to be a consummate politician.