Canadian Prime Minister attacked on all sides in first debate before October's election

New Democrat Party leader Thomas Mulcair, left, listens as Conservative leader, Prime Minister Stephen Harpers speaks during the first leaders debate Thursday, Aug. 6, 2015, in Toronto. (Frank Gunn/The Canadian Press via AP) MANDATORY CREDIT (The Associated Press)

Leaders of Canada's four political parties, Liberal leader Justin Trudeau, left, shakes hands with Conservative leader Stephen Harper as Green party leader Elizabeth May, second from right, and New Democrat leader Thomas Mulcair embrace following the first leaders debate Thursday, Aug. 6, 2015, in Toronto. (Frank Gunn/The Canadian Press via AP) MANDATORY CREDIT (The Associated Press)

Leaders of Canada's four political parties, Liberal leader Justin Trudeau, left to right, Green Party leader Elizabeth May, New Democratic Party leader Thomas Mulcair and Conservative leader, Prime Minister Stephen Harper exchange views during the first leaders debate Thursday, Aug. 6, 2015, in Toronto. (Frank Gunn/The Canadian Press via AP) MANDATORY CREDIT (The Associated Press)

The leaders of Canada's four political parties faced off in the first debate Thursday before a federal election in October, with Prime Minister Stephen Harper fending off attacks in the first three way race in Canadian history.

Analysts say Liberal leader Justin Trudeau, son of late Prime Minister Pierre Trudeau, needed to have a strong showing or risk falling further behind in the polls. A clearly prepared Trudeau aggressively attacked Harper and leftist New Democrat opposition leader Thomas Mulcair.

Harper spent most of the night under attack and acknowledged that Canada might be in recession. Harper blamed low oil prices for the slumping economy.

Analysts say the election is a toss-up and Harper's Conservative party faces an uphill battle to form another majority government in Parliament. The election is Oct. 19.

Analysts say Mulcair and the opposition New Democrats have a chance to gain power for the first time after the party won control of the legislature in Alberta, Canada's most conservative province, a few months ago.

Trudeau has trailed in third place in recent polls after Harper's Conservatives have run repeated attack ads saying the 43-year-old is not ready for the job.

The vote on the left may split between the New Democrats and Liberals. The first televised debate was seen as a key test for Trudeau, the son of the man whose legacy Harper is trying to erase.

Former colleagues of Harper say his long-term goals are to kill the once widely entrenched notion that the Liberals — the party of long-time leaders Pierre Trudeau and Jean Chretien — are the natural party of government in Canada, and to redefine what it means to be Canadian.

Harper has managed to nudge a traditionally center-left country to the right since coming to power in 2006. He has gradually lowered sales and corporate taxes, avoided climate change legislation, supported the oil industry against the environmental lobby and increased military spending. He has also been a staunch supporter of Israel.

Nelson Wiseman, a University of Toronto political science professor, said Harper performed well in the debate despite repeated attacks and will hold onto his base support.

Few Canadians likely watched the debate. It wasn't broadcast on the major networks and was held just five days into the campaign. Harper called the election in the dead of summer last Sunday, triggering an unusual 11-week federal campaign rather than the usual five-week campaign. The campaign will be the longest in Canada since 1872, but each party has been unofficially campaigning for months.