FOR MORE than a decade, democracy has been in retreat around the world. Democratic governments, having wrongly assumed that the crumbling of the Soviet bloc inevitably would lead to a new era of freedom, have not marshaled much of a response. But this week President Obama sounded something like the beginning of a counterattack. If he acts on the vows he articulated in two speeches in New York and in a presidential memorandum, the United States could begin to shift the momentum.

“Oppressive governments are sharing ‘worst practices’ to weaken civil society,” Mr. Obama said in remarks addressed to democratic activists around the world. “We’re going to help you share the ‘best practices’ to stay strong and vibrant.” It is significant that the president recognized that dictators are banding together to promote autocracy and checkmate democracy. It could be even more significant if, having recognized the altered landscape, Mr. Obama really invigorates democracy promotion as a key plank of U.S. foreign policy.

In talks to the Clinton Global Initiative on Tuesday and the U.N. General Assembly on Wednesday, Mr. Obama mentioned democracy sparingly, preferring to talk about civil society. But he left no doubt about his meaning when he pledged “to stand with the courageous citizens and brave civil society groups who are working for equality and opportunity and justice and human dignity all over the world.” He saluted democracy activists, including in nations whose governments in the past he has been loath to offend — Ahmed Maher in Egypt, for example, and Liu Xiaobo and Ilham Tohti in China.

Mr. Obama ordered administration officials, “including those that do not traditionally work with civil society,” to make the defense of such freedom fighters a priority. The government should engage with civil society in other countries, even when local laws discourage it, he directed. Officials “shall oppose, through appropriate means, efforts by foreign governments that restrict the freedoms of expression, peaceful assembly, and association,” he said.

The specifics matter, but more important will be the follow-through. Mr. Obama has not been consistent on this subject. In May 2011, when the Arab Spring was in flower, he proclaimed “a new chapter in American diplomacy. . . . [A]fter decades of accepting the world as it is in the region, we have a chance to pursue the world as it should be. . . . It will be the policy of the United States to promote reform across the region, and to support transitions to democracy.” By September 2013 — in his U.N. speech just one year ago — Mr. Obama had explicitly struck democracy promotion from the nation’s “core interests” — as opposed, for example, to the “free flow of energy” from the Middle East. His policies have been more in keeping with the latter speech: As China, Russia, Egypt, Venezuela and other countries have become increasingly repressive, Mr. Obama has behaved as though their internal developments were hardly relevant to bilateral relations.

Now, as he is forced to confront an aggressive Russia and a rampaging Islamic State, he may be remembering that the United States and its allies cannot defeat Islamist fundamentalism or Russian neo-fascism without a more hopeful ideology of their own. “We are heirs to a proud legacy of freedom, and we are prepared to do what is necessary to secure that legacy for generations to come,” Mr. Obama pledged Wednesday. That would be a sound foundation for a reinvigorated, and more successful, foreign policy over the coming 28 months. The president could begin to act on his resolution when he meets with Egypt’s dictator — and Mr. Maher’s jailkeeper — on Thursday.