The election of Barack Obama as president provides a golden opportunity for Democrats to close the national security credibility gap that has troubled their party since the Vietnam war. The disastrous foreign policies of the Bush years, coupled with declining confidence in Republican stewardship of American national security, have created an opening for a Democratic administration to show that progressive policies are better able to secure and protect America in the 21st century. Selecting a capable Democrat to lead the department of defence is key to accomplishing this.

There are some good reasons, however, for keeping Republican Robert Gates on as secretary of defence, at least in the short term. The most obvious is Iraq. Still smarting from their election night spanking, conservatives will jump at any opportunity to attack the Obama administration's Iraq policy. Having peddled the myth that the surge "turned things around" in Iraq - the reality is that the surge managed only to contain the worst effects of a disastrous war – the guardians of Bush's legacy await any chance to lay the Republican failure of Iraq at the feet of the Democrats. Having Gates oversee the early stages of the US withdrawal from Iraq – which has already begun – will make this more difficult.

Retaining Gates also sends a reassuring message to the military. Spencer Ackerman argues that "getting out of Iraq requires buy-in from an officer corps that could be fairly described as schizophrenic: it wants out of Iraq at some point, but is acutely sensitive to any perceived slight, particularly from an incoming Democratic administration". Offering to keep Gates at his post would signal a willingness to work with an officer corps still resentful of Donald Rumsfeld's bullying and ease the transition during the vulnerable early months of Obama's presidency.

Most importantly, however, Gates has given strong indications that he understands that the invasion of Iraq was an attempt to deal with a 21st-century problem – amorphous networks of transnational terrorists – using 21st-century methods – "shock and awe". Gates has overseen the writing of the US army's new "Stability Operations Field Manual," which elevates humanitarian and relief work to an equal footing with defensive and offensive operations.

Speaking about Afghanistan in October, Gates said that "to be successful, the entirety of the Nato alliance, the European Union, NGOs, and other groups – the full panoply of military and civilian elements – must better integrate and coordinate with one another and also with the Afghan government". This was the latest in a series of speeches in which Gates laid out an integrated approach to national security, one which used the full range of powers of America and its partners.

Confronting future threats before they emerge requires more than the relentless application of military force, it requires addressing the economic and humanitarian issues that create the conditions from which threats arise. It's important for a Democratic administration – and eventually, a Democrat secretary of defence – to take ownership of these ideas. As the Obama administration establishes itself, however, secretary Gates should be invited to stay.