The federal government introduced a bill Friday that declares same-sex marriages "valid for the purposes of Canadian law" and lays out rules for same-sex divorce for non-residents.

The measures are aimed at closing a legal loophole that could have undermined thousands of gay marriages around the world.

The bill, called an act to amend the Civil Marriage Act, says it establishes a "new divorce process that allows a Canadian court to grant a divorce to non-resident spouses who reside in a state where a divorce cannot be granted to them because that state does not recognize the validity of their marriage."

The amendments would allow a court in the province where the marriage was performed to grant a divorce if there has been a breakdown of the marriage as "established by the spouses having lived separate and apart" for at least one year before a divorce is requested.

A similar one-year separation period exists for residents of Canada to be eligible for a divorce.

The divorce for non-residents would only be granted if neither spouse lives in Canada at the time the divorce is requested, by one or both individuals.

They also have to have lived in a state where a divorce cannot be granted because the marriage is not recognized as valid for at least one year, the amendments state.

The bill introduced Friday makes no proposed amendments to the Divorce Act, and the measures only apply to non-residents.

The new rules, if the bill is passed, would not address issues such as child or spousal support. Any arrangements for property, custody and access to children or support will be determined in the jurisdiction where the couple lives, the Justice Department said in a news release.

Canada's marriage laws do not have a residency requirement. But federal divorce laws do, and that means same-sex couples who travel to Canada to marry because the jurisdiction in which they live does not marry gays or lesbians run the risk of not having the legal means to divorce if the relationship sours.

The proposed changes have been prompted by a divorce case in Ontario involving a same-sex couple. The unidentified lesbian couple married in Canada in 2005 but split up in 2009. The partners are living in Florida and the United Kingdom. Both women want a divorce, but cannot get one where they now live because the state of Florida does not recognize their marriage, and though the U.K. grants civil partnerships to same-sex couples, it does not recognize the Canadian marriage.

Legal documents filed by the federal government in the case had argued that even though the couple married in Canada, the two couldn't be considered legally married because it wasn't recognized in their U.S. and United Kingdom homes.

Gay rights activists and opposition politicians accused the Tories of trying to rewrite the rules on same-sex marriage to suit their own agenda.

But the government says its opinion is that the marriages were valid and it doesn't want to reopen the debate on the definition of marriage.

"Recently it came to light that there was an anomaly in our civil marriage laws," Justice Minister Rob Nicholson said in a statement after the bill was introduced in the House of Commons. "We are fixing the anomaly in the law."

The lawyer in the case that brought the issue to light, Martha McCarthy, told CBC's Power & Politics on Friday, "We are grateful the bill addresses the validity of the marriages of non-residents and allows them to divorce. But the government set a fire and is now trying to get credit for putting it out."