The longest federal election campaign in modern Canadian history is ultimately to be Stephen Harper's last as Conservative leader, win or lose, a new book says.

The biography from Globe and Mail journalist John Ibbitson, simply titled "Stephen Harper," quotes people close to the prime minister as saying that Harper won't run again if the Conservatives win a government, whether minority or majority.

"Winning conditions were within reach if he campaigned well and a couple of the breaks came his way," Ibbitson writes. "He thought he could land a solid minority government, maybe even a slim majority. Either way, he wasn't planning on staying around much longer, those close to him believe."

If the Tories form a minority government, Harper is likely to wait a year before announcing his departure. Ibbitson writes. A majority would delay the announcement by a year. Harper would wait until midway through another four-year mandate to give a successor some leeway.

If the Conservatives fall into the opposition benches after Oct. 19, Ibbitson writes that Harper will resign almost immediately.

The book was to come out in September, but the early election call led to it being released early as an e-book. A print version will be available on Aug. 18.

The book crafts a picture of a boy who grew up in the Leaside area of Toronto and then went West to find his own path. Ibbitson chronicles Harper's life in politics, his drive to make a centre-right party the natural governing party and his desire for political power.

The book details Harper's thinking during his years as prime minister, including his disdain for a Supreme Court of Canada that overturned key legislation and rejected the appointment of Marc Nadon to its ranks. It looks at how he could have avoided the Senate scandal by more carefully considering the appointments of Mike Duffy, Patrick Brazeau and Pamela Wallin.

The Nadon ruling launched a public spat between the Prime Minister's Office and the court, with Harper's people suggesting Chief Justice Beverley McLachlin acted inappropriately during the selection process. Staff in the PMO had to talk Harper down from launching a "full, public assault on the impartiality of the court, but he still went pretty far."

Ibbitson writes that Harper has "repeatedly complained to his inner circle" that the court has become "a sociology seminar" where the judges can turn their "theories into law" and Parliament has no power to stop them.