NDP Leader Jack Layton is recovering in a Toronto hospital after successful surgery to repair a hip fracture.

"The surgery lasted three hours and went extremely well. Mr. Layton is currently in recovery and is resting comfortably. His prognosis is excellent," Rob McMahon, a Mount Sinai Hospital spokesperson, said in an email.

Layton recently suffered a hairline hip fracture that put him on crutches. The fracture worsened and needed immediate surgery.

NDP spokesperson Kathleen Monk said Layton is expected to recover quickly and plans to be back in Parliament by the time the Conservatives unveil their budget on March 22.

The NDP will play a crucial role on whether there is an election this spring.

Layton had also been undergoing treatment for prostate cancer, but neither health problem was expected to affect his ability to campaign if an election is triggered, Monk said.

"Mr. Layton is an active man with incredible stamina. We are confident and ready to fight an election campaign whenever that time may come," Monk wrote in an email to The Canadian Press.

The budget later this month is expected to set in motion a series of votes of confidence that could determine whether the Conservative government. If any of the three opposition parties refuses to back the budget, a federal election could be held as early as May 2.

Layton's New Democrats are pushing the Conservatives to implement several costly proposals in the upcoming budget, including a boost to the Guaranteed Income Supplement and dropping a sales tax on home heating fuel.

Layton has said his party's proposals are "practical and doable," despite Conservative intentions to cut government spending. But he told CTV's Power Play earlier this week that Prime Minister Stephen Harper "isn't giving much of a signal that he wants to work with us."

With a report from The Canadian Press