The United States must combat terrorism and promote democracy abroad, but military action should not be the primary option to do so, President Barack Obama said Wednesday in a speech touted as laying out his foreign policy for the remainder of his second term.

Obama Delivers Major Speech Aimed at Recasting U.S. Foreign Policy

President Barack Obama pauses while delivering the commencement address to the U.S. Military Academy at West Point’s Class of 2014, in West Point, N.Y., Wednesday, May 28, 2014. In a broad defense of his foreign policy, the president declared that the U.S. remains the world’s most indispensable nation, even after a “long season of war,” but argued for restraint before embarking on more military adventures. (AP Photo/Susan Walsh)

“It is absolutely true that in the 21st century, American isolationism is not an option,” Obama said during his commencement address at the U.S. Military Acadamy at West Point. “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; without building international support and legitimacy for our action, or leveling with the American people about the sacrifice required.”

Setting a post-war agenda with Americans out of Iraq and the war in Afghanistan winding down, much of the speech seemed to take an “on-the-one-hand, but-on-the-other” theme.

“Here’s my bottom line: America must always lead on the world stage,” Obama said. “If we don’t, no one else will. The military that you have joined is, and always will be, the backbone of that leadership. But U.S. 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.”

He said terrorism is the largest threat facing America, “but a strategy that involves invading every country that harbors terrorist networks is naïve and unsustainable.”

Obama asked Congress for $5 billion to fund a new counterterrorism partnership fund to ”train, build capacity, and facilitate partner countries on the front lines.”

“These resources will give us flexibility to fulfill different missions, including training security forces in Yemen who have gone on the offensive against Al Qaeda; supporting a multinational force to keep the peace in Somalia; working with European allies to train a functioning security force and border patrol in Libya; and facilitating French operations in Mali,” he said.

Obama Delivers Major Speech Aimed at Recasting U.S. Foreign Policy

Members of the U.S. Military Academy at West Point Class of 2014, in West Point, N.Y., wait for President Barack Obama to arrive, Wednesday, May 28, 2014. In a broad defense of his foreign policy, the president declared that the U.S. remains the world’s most indispensable nation, even after a “long season of war,” but argued for restraint before embarking on more military adventures. (AP Photo/Susan Walsh)

Voicing support for the Syrian rebels, Obama said he did not want to commit the American military to Syria, but believes other actions can be taken.

“With the additional resources I’m announcing today, we will step up our efforts to support Syria’s neighbors – Jordan and Lebanon; Turkey and Iraq – as they host refugees, and confront terrorists working across Syrian borders,” Obama said. “I will work with Congress to ramp up support for those in the Syrian opposition who offer the best alternative to terrorists.”

In calling for multilateral action, he hit Republicans for opposing to new laws on climate change and for opposing ratification of the Law of the Sea Treaty.

“We can’t call on others to make commitments to combat climate change if so many of our political leaders deny that it is taking place,” Obama said. “It’s a lot harder to call on China to resolve its maritime disputes under the Law of the Sea Convention when the United States Senate has refused to ratify it. – despite the repeated insistence of our top military leaders that the treaty advances our national security. That’s not leadership; that’s retreat.”

He also resurrected his old pledge to close the U.S. detention facility at Guantanamo Bay, and talked about the NSA data gathering.

“I believe in American exceptionalism with every fiber of my being. But what makes us exceptional is not our ability to flout international norms and the rule of law; it’s our willingness to affirm them through our actions,” Obama said.

“That’s why I will continue to push to close Gitmo – because American values and legal traditions don’t permit the indefinite detention of people beyond our borders,” he continued. “That’s why we are putting in place new restrictions on how America collects and uses intelligence – because we will have fewer partners and be less effective if a perception takes hold that we are conducting surveillance against ordinary citizens. America does not simply stand for stability, or the absence of conflict, no matter what the price; we stand for the more lasting peace that can only come through opportunity and freedom for people everywhere.”