PAISLEY, Scotland — When the results were in last September and the Scottish National Party lost its bid for Scotland’s independence, a spirited young separatist, Mhairi Black, walked past local officials of the Labour Party who were clapping sarcastically and goading her. “Better luck next time,” they said.  Ms. Black, a 20-year-old politics student, said she briefly considered head-butting them.  Eight months later, she got her revenge. Elected on Thursday as Britain’s youngest member of Parliament in over three centuries, Ms. Black won a once unthinkable victory against Douglas Alexander, one of the most senior Labour politicians, a former cabinet minister and the party’s national campaign strategist.  Her triumph in Paisley, a working-class town — as well as the 27-percentage-point swing in her party’s favor compared with five years ago — was emblematic of the radically changed political map that people in Scotland and Britain woke up to Friday: Scottish nationalists, who held six seats in the last British Parliament, won 56 out of Scotland’s 59 seats. Labour lost 40 of its 41 seats.  Overnight, the Scottish National Party, or S.N.P., ended Labour’s traditional dominance north of the border and emerged as the third-biggest force in Westminster, greatly complicating life for Prime Minister David Cameron as he embarks on a second term.  By Friday morning, Scotland and England looked and felt like different countries, and many wondered whether a breakup of Britain had become inevitable.  Nicola Sturgeon, the popular leader of Scotland’s semiautonomous government and of the S.N.P., has made no secret of her wish for independence. But Ms. Sturgeon, who did not run for a seat in the House of Commons, has also said that even a decisive victory in these elections would not be a mandate for another referendum. Circumstances would have to change, she said.  With Mr. Cameron still in power, they may: He has promised a referendum on Britain’s membership in the European Union. If Britain left the union, a more pro-European Scotland would almost certainly make a case to leave Britain.  For many voters here, another bid for independence after Thursday’s elections is now a question of when, not if.  Fifty percent of Scottish voters backed the S.N.P. in the elections, a bigger share than the 45 percent who voted for independence last fall. But that still leaves the other half of the electorate opposed.  “It might take awhile to fall apart, but it’s very difficult to see how the union might be salvaged,” said David Torrance, a Scottish writer and journalist. “In a spiritual sense, it is more or less dead already.”  Many thought that the independence referendum in September would end the debate for a generation. Instead, it electrified politics here. Turnout in Scotland was down from the referendum’s record 84.5 percent but still impressive at 71.1 percent.  “Here is the queer thing, the thrilling thing and the frightening thing,” the columnist Ian Jack wrote in The Guardian recently. “Among the food banks and the trampled front gardens of the big housing schemes, poor people here have begun to feel they have power.”  Back in Paisley, Ms. Black loves football and still has to take her final exams at the University of Glasgow. (“It’s on Scottish politics; I think I have a chance,” she said.) She has spent much of the past two years campaigning for independence.  “There was a lot of regret, even among those who voted no,” she said in an interview before the elections. “As soon as the vote was over, Scotland felt cast aside again.”  Since the referendum, the Scottish National Party has quadrupled its membership, to nearly 110,000. Many of these new supporters used to vote for Labour but say they no longer trust a party perceived to have betrayed its working-class roots.  David Smith, 52, a security guard, is one of those new S.N.P. supporters. Labour, he said, had just become “red Tories,” little different from the Conservatives.  That perception was only reinforced by the image of Ed Miliband, the Labour leader until his resignation on Friday, standing with Mr. Cameron during the last panicked week of the referendum campaign, pressing the Scots not to leave Britain. “They’re all the same,” Mr. Smith scoffed.  These days it is the Scottish National Party, despite its centrist track record in government, that has become most associated with traditional left-wing ideas.  Across Scotland, Labour seats long perceived as safe fell to the S.N.P. The leader of the Scottish Labour Party, Jim Murphy, lost, as did a former deputy leader, Anas Sarwar. Alison Thewliss, who beat Mr. Sarwar, said the results were indicative of “a loss of faith in a Labour Party that has drifted so far from the principles that it once held dear.”  Even Edinburgh, the home of Adam Smith and David Hume, which last year voted 61 percent against independence, elected four S.N.P. lawmakers.  Mr. Alexander, the Labour campaign director who was ousted by Ms. Black in Paisley, had represented the area in Parliament since 1997. Five years ago, he won the seat with 59.6 percent of the vote. As recently as January, his was considered a safe seat.  Then the polls started turning. In recent weeks, the shift became palpable. As one former Labour member of Parliament here told The Economist: “It’s like the last days of Rome. Without sex. Or wine. In fact, with none of the fun bits.”  An earlier version of this article misidentified the Scottish historical figure associated with Edinburgh. It was David Hume, not John Hume. And an earlier version also referred incorrectly to a Scottish lawmaker, Anas Sarwar, on second reference. He is Mr. Sarwar, not Ms. Sarwar.  A version of this article appears in print on May 9, 2015, on page A6 of the New York edition with the headline: Major Gains for Scottish Nationalists Reinvigorate the Independence Movement . Order Reprints| Today's Paper|Subscribe
The bid for Scottish independence from Britain may have failed last year, but it set in motion forces that ended Labour Party dominance in Scotland.