Jagmeet Singh, the leader of Canada's New Democrats Party (NDP), has won his first seat in parliament after a by-election bid in British Columbia.
The party premier secured 38% of votes in a closely-watched race in Burnaby, east of Vancouver.
Mr Singh, 40, is the first ethnic minority to lead a major federal party in the country.
His win comes ahead of general elections in October and is seen as a boost for his leadership.
"Friends, we made history today," he told supporters after learning the results. "Guess what? We just told a lot of kids out there that yes, you can."
His new seat, Burnaby-South, opened up after fellow NDP member Kennedy Stewart resigned to become mayor of Vancouver.
The town's election race made headlines in January after Liberal candidate Karen Wang stepped down after making remarks about Mr Singh that some said amounted to racism.
Ms Wang wrote a post on the website WeChat in which she said that as the only Chinese candidate in the race she stood a good chance of winning, and pointed out Mr Singh's Indian descent.
Announcing her resignation, she said her "choice of words wasn't well-considered and didn't reflect my intent", but she denied that they were racist.
Mr Singh is a practising Sikh and former provincial Ontario legislator, and became leader of the centre-left party in 2017 despite no experience of federal politics. During the NDP's leadership campaign, a video of his reaction to an angry heckler at a campaign rally went viral.
Despite success in Burnaby, the NDP failed to secure seats in Canada's two other by-elections. Liberal contender Rachel Bendayan ousted the party from Montreal's Outremont constituency, which the NDP had held for over a decade.
The Conservatives also held onto seat in the Ontario constituency of York-Simcoe.
By-elections are held in Canada when a seat is vacated by a member of Parliament (MP) between general elections.
What does this mean for the coming election?
Monday's victory was a necessary breakthrough for Mr Singh's leadership, which had been undermined by poor polling, fundraising difficulties, and internal party divisions.
The NDP has never held power and is currently the third place party in Canada's Parliament, holding 40 of 338 seats in the House of Commons. A quarter of its MPs who won seats in the 2015 election have either resigned or announced they are not running again in October.
In an interview with CTV last month, former NDP leader Thomas Mulcair said "it would be extremely difficult for Mr. Singh to stick around" if his parliamentary bid failed.
But losing the seat in Outremont to the Liberals on Monday is still a blow for the party.
That seat, which was won by Mr Mulcair in 2007, was a foothold in the vote-rich province of Quebec and helped launch the so-called "Orange Wave" of support for the NDP in 2011.
The NDP made historic gains in that year's general election and were catapulted into Official Opposition, only to lose almost a million votes - mostly to Justin Trudeau's Liberals - four years later.