EDINBURGH — Alex Salmond, who led Scotland’s failed bid for independence, announced on Friday that he would step down as first minister of Scotland and leader of the Scottish National Party later this year.

The unexpected announcement came the day after voters spurned the vision of Scottish sovereignty that had propelled his political career for decades, and voted decisively in a referendum to continue Scotland’s 307-year-old union with Britain. Mr. Salmond was by far the most prominent casualty of the defeat.

The independence campaign that he led sent shock waves through Britain’s political elite, energized Scottish politics as rarely before and appeared to open the way for a looser, more federal Britain. After starting far behind in the polls, the independence campaign appeared to close the gap in the increasingly suspenseful final weeks, and in some surveys it even seemed to take a slight lead.

But when the ballots from all 32 voting districts were tallied early Friday, the “no” campaign had won 55.3 percent of the vote.