President Barack Obama mounted a defiant defense of his global leadership Wednesday, rebuking critics who see him as weak but warning that not every global threat justifies a US military response.
In a major speech at the West Point military academy, Obama denied US power had ebbed under his watch, after he withdrew troops from Iraq and as he does the same in Afghanistan.
He also pledged to ramp up support for Syrian rebels, vowed to stand up to Russia over Ukraine and promised to make drone strikes against terror suspects more transparent.
He vowed to hold China accountable to international "rules of the road" in the South China Sea and elsewhere.
"To say that we have an interest in pursuing peace and freedom beyond our borders is not to say that every problem has a military solution," Obama said.
"Since World War II, some of our most costly mistakes came not from our restraint, but from our willingness to rush into military adventures -- without thinking through the consequences," Obama said, in an apparent reference to the Iraq war, which he has branded a disaster.
The president's speech came with his foreign policy, which was once seen as a political asset, under assault from critics who believe he is being outmaneuvered by strongmen like Russian President Vladimir Putin and China's President Xi Jinping.
"Here's my bottom line: America must always lead on the world stage. If we don't, no one else will. The military ... is, and always will be, the backbone of that leadership."
Obama was particularly exercised by those who complain he should have deployed the US military in Syria or made a more robust strategic response to Russia's annexation of Ukraine, or who complain that he has left Iraq or Afghanistan to fend for themselves.
"Tough talk often draws headlines but war rarely conforms to slogans," Obama said.
"But US military action cannot be the only, or even primary, component of our leadership in every instance.
"Just because we have the best hammer does not mean that every problem is a nail," Obama told a graduation ceremony at the college.
"And because the costs associated with military action are so high, you should expect every civilian leader - and especially your commander in chief - to be clear about how that awesome power should be used."
Obama said he was "haunted" by the deaths of American servicemen under his watch -- including some who attended previous commencement ceremonies he had given at West Point.
Obama also made an implicit defense of his decision to call off military strikes on Syria at the last minute last year to punish chemical weapons strikes.
Critics at home and abroad warned that the decision left dangerous questions about whether Washington would stand up to "red lines" elsewhere in the world.
"I would betray my duty to you, and to the country we love, if I sent you into harm's way simply because I saw a problem somewhere in the world that needed fixing, or because I was worried about critics who think military intervention is the only way for America to avoid looking weak," he told the graduates.
Obama has been under increasing pressure to do more to support Syrian rebels battling President Bashar al-Assad and offer some relief to civilians reeling under strikes including barrel bombings carried out by the regime.
"As frustrating as it is, there are no easy answers - no military solution that can eliminate the terrible suffering anytime soon," Obama said.
"As president, I made a decision that we should not put American troops into the middle of this increasingly sectarian civil war, and I believe that is the right decision.
"But that does not mean we shouldn't help the Syrian people stand up against a dictator who bombs and starves his people."
Obama said that he would work with lawmakers to ramp up support for the opposition, but did not give details, amid reports the US military will begin openly training rebel forces. The CIA is believed to be carrying out a covert program to train and arm some rebels.
Washington has been loath, however, to send game-changing weapons like anti-aircraft missiles to rebel forces which it fears could fall into the hands of extremists.
Obama also said that terrorism remained the biggest national security threat to the United States and unveiled a new $5 billion fund to equip and train allies on the front lines of the struggle against terrorism, for instance in Africa.
He also defended his decision to leave nearly 10,000 troops in Afghanistan for a year after combat troops leave at the end of this year, and to gradually reduce the presence to a detachment of troops at the US embassy in Kabul by the end of 2016, just before he leaves office.