When President Barack Obama said in his victory speech that "a decade of war is ending," he made clear the primary focus of his foreign policy: having completed the withdrawal of US troops from Iraq, he would not be deterred from exiting Afghanistan by 2014.
In a deeply polarised country, one of the few things that Americans agree on is not wanting to see US troop fighting any more unwinnable wars abroad.
The troop surge that Mr Obama ordered for Afghanistan is deemed a success - despite evidence to the contrary - and will have to serve as a justification for going home, even if Afghan security forces are unprepared. It provides a tenuous parallel with Iraq where President George W Bush's 2007 troop surge, aided by the decision of some tribal leaders in Anbar province to join the Americans in fighting the jihadist interlopers, did indeed turn the conflict around.
The US exit strategy for two failed wars can be summed up as "surge and go". That much is clear. But what about Mr Obama's promise about the next stage? He said that the US will move "beyond this time of war" to shape a peace "built on the promise of freedom and dignity for every human being".
We do not know who will be the principals in Mr Obama's foreign policy team. Hillary Clinton, the secretary of state, is expected to retire after what is widely seen as a very successful term in office. Senator John Kerry, the Democratic presidential candidate in 2004, is an obvious choice as successor, but he may be more useful in his current role as chairman of the Senate foreign relations committee.
There will be a natural temptation for Mr Obama to seek to shape his legacy abroad, given the prospect of continuing gridlock in domestic policy. The consensus is that the cornerstone of foreign policy will be a strategic shift towards the Asia-Pacific region, known by the ambiguous term of "pivot to Asia". Although this change was announced in 2011, the substance is not entirely clear, leaving the Chinese to conclude that it is aimed at curtailing their rising power and assertiveness.
Logically, this would entail diverting US resources from the ground forces that have seen so much action in Iraq and Afghanistan into the navy, and building more ships, as Mitt Romney, the defeated Republican presidential candidate, proposed. But with defence budgets set to decline, that is unlikely to happen.
What is clear is that a "pivot" to Asia means that the US no longer intends to play a pivotal role in the Middle East. This is already happening: America let its allies fall to popular protest in Tunisia, Egypt and Yemen; it "led from behind" in Libya; and has stayed on the sidelines of the conflict in Syria. Mr Obama has concluded that Washington cannot shape the destinies of the region as it has tried to do since the 1950s.
America's allies are keen to see more engagement in Syria now that the election campaign is won. David Cameron, the British prime minister, says he wants to talk to Mr Obama about "how we must do more to try to solve this crisis". There is a hope that Mr Obama will follow the lead of Bill Clinton, who was wary of foreign entanglements in his first term, but went on to intervene forcefully in the Bosnia and Kosovo wars.
This view is not necessarily shared in Washington. Daniel Drezner, a professor of international politics at the Fletcher School of Law and Diplomacy at Tufts University, told an audience at Chatham House in London that realpolitik dictated that the US should let the regime in Syria and its opponents fight it out, so that Iran is bled dry through supporting its ally.
As for Iran, Mr Obama will have to reach a decision over the next two years on how to establish international safeguards on its nuclear programme.
But any possible diplomatic solution would involve Iran being allowed to enrich some uranium, and this would set off a confrontation with Israel. The prime minister, Benjamin Netanyahu, has called elections for January to secure a new mandate to strengthen his position against the US president whom he characterises as lacking moral authority.
How a US president reduces his engagement in an unstable region is a diplomatic conundrum that no one can answer yet. The same goes for the success of the US promise to refocus on the Asia-Pacific region without provoking an aggressive Chinese response.
China is in the process of choosing a new leadership at a time when communist ideology provides no clues to the future and when the stellar growth rates that have raised living standards are declining. Nationalism is an obvious path to direct discontent away from the ruling party towards foreigners. This is already happening with Japan, in the dispute over the uninhabited islands known as Senkaku to the Japanese and Diaoyu in China.
No one is suggesting that the new leadership is going to set out on a path of wild adventurism. But the sharpening rhetoric creates a situation where a small incident could easily blow up into a major confrontation into which the US would inevitably be drawn.
The "pivot" to Asia suggests that the US is trying belatedly to bolster a flagging pax Americana in the region. The Chinese military will ask, if now is not the time to challenge US supremacy, when will it be time?
In 2003, General David Petraeus, then a senior commander in Iraq, famously asked: "Tell me how this ends." Almost a decade on, Gen Petraeus now in charge of the CIA, and knows how foreign military entanglements end: when American public opinion decides.
But that is only a partial answer to the general's question. Even when the troops are gone, there are swathes of the Earth that are beset by the ambitions of rival states and non-state actors. Ending wars will prove to be easier than shaping peace.