The Liberals and New Democrats have been dancing around the idea of a deal to work together since the 2019 election first reduced the Trudeau government to a minority.

But talk of the agreement revealed Tuesday, which will see the NDP support the Liberals on matters of confidence until 2025, did not get really serious until the two party leaders had a bonding moment over fatherhood.

NDP Leader Jagmeet Singh and his wife, Toronto fashion designer Gurkiran Kaur Sidhu, welcomed their first child on Jan. 3. Prime Minister Justin Trudeau, already a father to three, called to congratulate Singh.

The Canadian Press interviewed multiple sources from both parties about the events that led to Tuesday's announcement. They all spoke on the condition they not be named because of the sensitive nature of the talks.

Those sources said that phone call went so well, both Trudeau and Singh wondered if they could use it to restart discussions about an arrangement the Liberals had first initiated after the September 2021 election.

The Liberals had gone into that election hoping to regain their majority status, but then Canadians ended up voting in essentially the same makeup of Parliament as before. The Liberals worried the House of Commons would remain as hyper-partisan and unproductive as they had believed it to be before triggering the election.

In the days after the vote, Trudeau's team considered how to change that.

Meanwhile, Singh, who had informally chatted about agreements to support the Liberals since 2019, was waiting for another call.

In the room where it happened: How the Liberal-NDP confidence deal was struck. #CDNPoli #Liberals #NDP

Singh and Trudeau met face to face on Oct. 20. A week later, the first whiffs about talks on a deal between the two parties began to leak out.

On Nov. 8, NDP MP Charlie Angus confirmed talks were underway.

The response was explosive, particularly from Conservatives.

The minority government of former prime minister Stephen Harper had faced being booted out by a proposed NDP-Liberal coalition in 2008, with the support of the Bloc Québécois. The Conservatives have taken a hard line against any notion of formal agreements between political parties in the House of Commons ever since.

The result, the sources said, was to put everything on hold until the new year. A deal would not be negotiated in public.

In January, Trudeau picked up the phone to congratulate Singh on the birth of his daughter, Anhad. They both agreed to get the stalled discussions back underway.

Just as they began to do that, hundreds of protesters against vaccine mandates, other COVID-19 restrictions and the Liberal government descended on Parliament Hill and blockaded multiple border crossings. Some in the ranks were threatening to overthrow the government.

Both Singh and Trudeau condemned the protests for wanting to disrupt democracy, and for the elements of white supremacy and violence lurking within the group.

When Trudeau invoked the Emergencies Act, arguing the extraordinary powers were needed to clear the blockades, it was the NDP that provided the backing to get the measures through the House of Commons.

And then days after the police did finally bring what local leaders called an occupation of downtown Ottawa to an end, Russia invaded Ukraine, ending decades of peace in Europe and bringing another threat to the world.

Canadians, the sources said Singh and Trudeau both believed, needed some stability.

And so they began to meet in earnest — more than half a dozen times, just the two of them. Sometimes it was on a video call, sometimes on the phone and sometimes in person. In between meetings, staff would work to get their agreements into writing.

Last week, they met one final time at Rideau Cottage, which is where Trudeau lives with his family, for a lengthy discussion that brought all the big issues to a close.

On Friday, they agreed the deal was ready to go to their caucuses.

That happened Monday night.

Until then, everything was kept to a very small, closed circle. It had to happen that way to avoid a repeat of the fall publicity, one source said.

Cabinet as a whole didn't know it was happening. Neither did the full NDP caucus. Some were consulted on specific issues. Finance Minister Chrystia Freeland was brought in to talk about the budget needs. NDP health critic Don Davies said Tuesday he also worked to provide information to the leadership team.

National pharmacare and dental-care programs, which the NDP have long championed, had to get Liberal buy-in for the deal to work. The Liberals had also talked about pharmacare but it wasn't in their most recent election platform. Plans to implement both were released in the details of the confidence and supply agreement published Tuesday.

Anne McGrath, national director for the NDP, and Katie Telford, Trudeau's chief of staff, were the main parties at the table besides Singh and Trudeau, the sources said. Others, including Singh's chief of staff, Jennifer Howard, and his director of communications, Melanie Richer, also pored over the draft text of the deal.

On Tuesday, Trudeau said the agreement is "a responsible answer to the uncertainty we’re in, to the challenges facing democracies with hyper-partisanship and toxic polarization."

"What this means is that during this uncertain time, the government can function with predictability and stability, present and implement budgets and get things done for Canadians," he said.

Singh said the NDP's motivation was to help Canadians, and to get them affordable dental care and medication. But he said he was going into the deal with optimism and "eyes wide open," comparing the deal to a marriage. He said his caucus supported it.

The agreement lays out areas of co-operation, but is not a formal coalition. The NDP will not participate in cabinet or government decision-making. They did not request that nor was it offered, Singh said.

B.C. NDP MP Jenny Kwan said there was a "range of opinions" in caucus about the deal, but that many MPs were very excited about finally making pharmacare and dental care a reality.

"If we were in government, we would be able to do more, but this is a minority government and so this is about compromising, getting as much as you can," she said.

Northern Affairs Minister Dan Vandal said the deal means the government finally has some time to get things done. The Liberals were elected with a majority in 2015 and have had a minority since 2019.

Vandal said the convoy was a catalyst in the sense that it made clear that "the Liberals and the NDP were the adults in the room" and could and should find a way to work together.

Singh and Trudeau held separate press conferences Tuesday, a clear attempt to show independence and prove they are not a coalition.

Interim Conservative leader Candice Bergen did not buy that, blasting a "backroom deal that would see Justin Trudeau get the majority power that he tried desperately to get last fall in the last election, but he failed to get."

And in doing so, she said, he has given power to the NDP and sounds the death knell for Canada's fossil-fuel industry.

"All of which, for Canadians, means more debt, more inflation, more jobs lost, more uncertainty, and frankly, more polarization," she added. "This is not a good day for Canadians."

While he also condemned the deal for giving the Liberals a "false majority," Bloc Québécois Leader Yves-François Blanchet said the agreement would not change his party's approach in Parliament.

The text of the agreement, unlike the failed 2008 NDP-Liberal coalition deal, is not signed. It does list the areas they will co-operate and specifics of some of those policies, such as a new dental-care program for Canadians with household incomes up to $90,000.

The rest of the list is drawn entirely from the parties' 2021 campaign platforms, but many of the pledges have no road map for completion. They include phasing out government subsides for fossil fuels, forbidding the use of replacement workers in federal industries during strikes or lockouts, and supporting Indigenous communities that wish to undertake burial searches at the former sites of residential schools.

They also agree to work on fair taxation measures, including changes for financial institutions that have made strong profits during the pandemic, and collaborate with Elections Canada on ways to make it easier to vote. Making sure that Quebec keeps its 78 seats in the House of Commons is also part of the arrangement.

This report by The Canadian Press was first published March 22, 2022.

Keep reading