HAMILTON — Hugo Keenan scored a try on the final possession of the game as Canada fell to Irish club Leinster 38-35 on Saturday in the first of three Rugby World Cup send-off matches for the national team.

Patrick Parfrey scored a pair of tries as the Canadian squad erased a 19-0 deficit in the early going of the match. Evan Olmstead, Tyler Adron, and Kyle Baillie also had tries, while Peter Nelson connected on all five conversion goals attempted.

"The boys are happy that we fought back and ended up making it a very close game," Parfrey said. "We're obviously disappointed about losing, but there's a lot of things we did well in this game so we're happy with the process."

Canada led by 11 points late in the second half and appeared to have the match under control. But the two-time defending Pro14 champions stormed back with a pair of tries to secure the victory.

"They were forcing things that led to a lot of penalties against us," Canada coach Kingsley Jones said. "We were able to improve the line-out as we went along and I was very pleased that we got a lead."

For a Canadian squad looking to find its identity, playing a warmup for the 2019 World Cup in Japan is a gift considering the team's long road to qualification.

World Cup mainstays of past tournaments, Canada had to take the long road to qualification after finishing without a win at the 2015 edition of the competition in England.

The team had two different chances at an Americas qualifying tournament. They lost to the United States in a home-and-home in 2016 to put the squad into a repechage with Uruguay. Canada lost the ensuing home-and-home series with the South Americans in 2017 that put them into a last-chance tournament last November.

Canada finished 3-0-0 at the final repechage to claim the 20th and final spot. The Canadians are in one of the harder pools of the tournament, situated with three-time World Cup champions New Zealand and heavyweights South Africa.

"There's no doubt we're behind the eight-ball. Other teams have had two or four years minimum to prepare for the competition," Jones said. "But we've had a good four-to-five weeks and we just have to keep building on the momentum and hopefully it will reflect on the scoreboard which it almost did today."

Leinster dominated possession to start the game. After multiple scrums deep in Canada territory, Max Deegan scored the try for the Irish squad for a 5-0 lead.

Canada got to the five-metre area on its first possession, but Leinster kept the Canadians off the scoreboard.

Leinster's Bryan Byrne scored a try on the ensuing possession for a 10-0 lead. Ciaran Frawley would hit the conversion to give the Pro14 champions a 12-0 lead before a water break at the 20-minute mark of the opening half.

Leinster continued to dominate after the short break. Caelan Doris scored a try and Frawley scored on the ensuing conversion to give the team a 19-0 lead.

Canada got on the scoreboard late in half. On the final possession before halftime, Olmstead scored a try and Nelson grabbed the conversion to cut Leinster's lead to 19-7 at halftime.

The Canadians started the second half strong. Adron scored a try and Nelson picked up his second conversion to cut Leinster's lead to 19-14.

Parfrey followed with his first try of the game to tie it 19-19. Nelson would hit his third conversion of the game to give Canada a 21-19 lead.

Leinster would regain the lead when Deegan would score his second try of the match to make it 24-21. A conversion attempt by Josh Murphy was unsuccessful.

Canada stormed back on a quick try from Kyle Baillie. Nelson would hit the conversion and Canada led it 28-24.

Parfrey followed with his second try of the match. Combined with a Nelson conversion, Canada took a 35-24 lead.

In the 72nd minute, Doris would score his second conversion. The ensuing conversion cut Canada's lead to 35-31.

In the final seconds of the match, Keegan scored a try which would be reviewed and later held as the match-winner.

Up next for the national team is a pair of send-off matches out west. They take on the BC All Stars in Langford on August 30, and the U.S. in Vancouver on September 7.

The 2019 Rugby World Cup takes place September 20 to November 2 in Japan.