LONDON — A little more than two years after a far-right, anti-immigrant militant killed 77 people, many of them teenagers, Norwegian voters ousted their center-left government on Monday, paving the way for the conservative leader, Erna Solberg, to assemble a governing coalition that may include an anti-immigration party.

Ms. Solberg, 52, a former Girl Scout leader nicknamed “Iron Erna,” will be Norway’s first conservative leader since 1990 and its second female prime minister.

“We will give this country a new government,” Ms. Solberg said after Prime Minister Jens Stoltenberg conceded defeat.

The campaign had been centered largely on economic issues, like extending already generous welfare payments (Labor) versus cutting taxes and privatizing hospitals (Conservatives). But the massacre on the island of Utoya, where Anders Behring Breivik attacked youth members of the Labor Party on July 22, 2011, was never far from the surface.