CALGARY, Alberta (Reuters) - Canadian Prime Minister Stephen Harper's Conservatives narrowly hung onto what had been considered one of their safest seats on Monday as voters elected their candidate in a by-election that became a contentious referendum on the government's policies.
In the electoral district of Calgary Centre, Conservative candidate Joan Crockatt, who had the support of the right wing of the party, was leading Liberal challenger Harvey Locke with 37.4 percent of the vote to 32.5 percent with most of the votes tallied.
The result in the Western Canadian district, headquarters of the country's oil industry and long the Conservatives' power base, would never have altered the balance of power in Ottawa, where Harper's party won a comfortable majority in the spring 2011 election.
But the race was much closer than early polls predicted. A loss to the Liberals would have been a shock, as that party has not won an election in the Alberta city since 1968. It would have forced the Harper Conservatives to rethink strategy in the next federal election in 2015 after years of focusing efforts on other parts of Canada where results have been far less certain.
Several national issues played out in the campaign in the district of 125,000 people in the city of 1.1 million. The controversial takeover bid for Nexen Inc by Chinese state-owned oil company CNOOC Ltd, the Conservatives' strong promotion of increased oil exports and the environmental impact of oil sands output.
Late in the race, Locke has been forced to deal with some anti-Alberta remarks by some of the party's national figures, including two-year-old barbs by leadership hopeful Justin Trudeau.
Locke and the third-place challenger, Chris Turner of the Green Party, are both known as environmentalists. It is clear they split the moderate and left-of-center vote, as Turner took 25.7 percent.
The race was one of three by-elections on Monday to fill vacant seats in the House of Commons. In Durham in Ontario, the Conservatives easily held their position, with Erin O'Toole taking more than half the vote.
In Victoria, British Columbia, the Green candidate had just a 1.3 percentage point lead over the federal opposition New Democratic Party with ballots from dozens of polls still to be counted. It has been an NDP holding.
Reporting by Jeffrey Jones; Editing by Lisa Shumaker