Liberal backbench MPs joined forces with opposition parties Wednesday evening to reject attempts by the government to gut a genetic discrimination bill, overwhelmingly passing the legislation and defying the wishes of cabinet.

Recently retired Liberal senator Jim Cowan watched from the viewing gallery as 222 MPs voted in favour of his legislation, something he has long fought for through successive parliamentary sessions.

All cabinet ministers — and most parliamentary secretaries — in attendance voted against the bill. Only four Liberal backbenchers sided with the government, a rare display of disunity within the Grit ranks.

Justice Minister Jody Wilson-Raybould was opposed to the bill and said she believes the legislation is unconstitutional as it could infringe on the provinces' right to regulate the insurance industry.

Bill S-201 will add genetic characteristics as a protected ground under the Canadian Human Rights Act, introduce penalties for discrimination, and forbid employers from subjecting job applicants to a genetic test.

The legislation will also allow people to refuse to disclose the results of a genetic test to anybody. Medical experts have said the legislation is necessary to counter the fears associated with potentially life-saving genetic testing, which could produce results that would help doctors better tailor health treatments.

A breach of the law could result in a fine of up to $1 million, or five years behind bars.

As previously reported by CBC News Tuesday, Anna Gainey, president of the federal Liberals, penned a letter during the last election promising protections against genetic discrimination if elected.

Some have suggested the Liberal flip-flop was the result of aggressive lobbying tactics by the insurance industry.

The industry has not hidden its opposition to Cowan's private member's bill, a piece of legislation that easily passed the Senate last April and the House of Commons justice committee in December.

"The life and health insurance industry is extremely disappointed that Bill S-201 was passed today in the House of Commons without significant amendment.

"The industry agrees with the federal government's position as expressed by the prime minister and the minister of justice, as well as a number of provinces, that an important element of the bill is unconstitutional," Wendy Hope, a spokesperson for the Canadian Life and Health Insurance Association, said in an emailed statement to CBC News after the vote.

Trudeau says bill unconstitutional

The federal government has to consider multiple factors when making decisions, Trudeau said Wednesday ahead of the vote, noting it needs to ensure it is defending the rights of Canadians and upholding their freedom from discrimination.

It also has to defend the Constitution and the balance between federal and provincial jurisdictions, he added.

"The government has taken a position that one of the elements in the proposed bill is unconstitutional," Trudeau told a news conference.

"That is the recommendation we had and the government position is to vote against that particular ... element in the bill."

The Liberal government had proposed stripping the bill of everything except the power to make genetic characteristics a prohibited ground of discrimination under the Canadian Human Rights Act, but those amendments were rejected Wednesday evening.

The bill has now cleared both the House of Commons and the Senate but will only become law when it receives royal assent, which could take place in the next few days. 

'There are differences in our Liberal caucus, but not a divide,' says MP Rob Oliphant6:48

With files from the Canadian Press