WASHINGTON — The Supreme Court’s immigration ruling is a defeat for President Obama but could help Hillary Clinton and the fortunes of Democratic candidates across the country.

The court on Thursday blocked Mr. Obama from moving ahead with his sweeping assertion of executive authority and will force him to leave office next year without the major progress he promised to millions of Latino immigrants living under the threat of deportation.

But even as Republicans hailed what they called a major victory, Democrats said they believed the ruling would energize a nationwide voter registration drive intended to benefit Mrs. Clinton in her presidential campaign against Donald J. Trump. Within moments of the court’s nine-word order, Democratic activists vowed to mobilize, and a president whose face was etched with disappointment acknowledged the issue now rested with voters.

“We’ve got a choice about who we’re going to be as a country, what we want to teach our kids, and how we want to be represented in Congress, and in the White House,” Mr. Obama told reporters on Thursday morning. “Americans are going to have to make a decision about what we care about and who we are.”