Wayne Gretzky says he was doing Stephen Harper "a favour" when he appeared with him at a campaign event, and the Great One says he would do the same for any prime minister.

Harper and Gretzky played table hockey with some children at an event in Toronto last month.

The prime minister interviewed Gretzky in front of hundreds of supporters and the conversation mostly focused on hockey — until the end. The Hockey Hall of Famer told Harper he thought he had been an "unreal prime minister" who had been "wonderful to the whole country."

Harper's Conservatives were voted out of office when Justin Trudeau's Liberals won a majority government in Monday's federal election.

Gretzky has backed Conservative politicians before. He came out in support of Ontario Progressive Conservative Leader Patrick Brown in February during Brown's run for the party leadership.

But in an interview Thursday, Gretzky said he always heeds a prime minister's call, and the Harper event was no different.