WASHINGTON — President Obama says the United States must resist the urge to “overreach” abroad, as he outlined a new national security strategy Friday that is meant to serve as a blueprint for his final two years in office.

The 29-page document hews closely to Obama’s long-held views of America’s role in the world and forecasts no major shifts in the military campaign against Islamic State militants or in the conflict between Russia and Ukraine. Beyond those immediate concerns, he also calls for boosting cybersecurity, combatting climate change and promoting gay rights around the world.

Even as Obama cast U.S. leadership as indispensable, he said the country’s “resources and influence are not infinite.” He said that the threat of a terrorist attack against the homeland “has diminished, but still persists.” Obama also said that he remains committed to combating groups like Islamic State, not through large-scale ground wars but through targeted counterterrorism operations.

“The United States will always defend our interests and uphold our commitments to allies and partners,” he wrote in an introduction to the White House strategy paper.

“But we have to make hard choices among many competing priorities,” he said, “and we must always resist the over-reach that comes when we make decisions based upon fear.”

Obama’s critics have accused the president of putting his desire to keep the U.S. out of overseas conflicts ahead of the need for more robust action against the world’s bad actors. Some members of Congress have called for Obama to send more American ground troops to the Middle East to combat the Islamic State group, while also pushing for the White House to authorize shipments of defensive weapons to Ukraine to help its beleaguered military in the fight against Russian-backed separatists.

Administration officials have said that Obama is reconsidering his opposition to giving Ukraine lethal aid, though he continues to have concerns about the effectiveness of that step.

Obama’s security strategy comes amid fresh fears of cyberattacks following the hacking of Sony, which the U.S. blamed on North Korea. The president said the U.S. would “impose costs on malicious cyber actors,” though he did not specify what those costs would be.