VANCOUVER (Reuters) - Medical marijuana patients in Canada will regain the right to grow their own cannabis after the government said on Thursday it would comply with a federal court decision against a ban introduced by the previous Conservative government.

The federal government said Canada's medical marijuana laws would be rewritten to reflect the court's judgment, setting a deadline of Aug. 24 to finalize the changes.

"We are committed, as you know, to making sure that Canadians who require marijuana for medical purposes have appropriate access to that," Health Minister Jane Philpott told reporters in Ottawa, adding that the current law will remain in place until the changes are finalized.

Philpott did not provide specifics on the planned amendments, but noted the government was focused on addressing the issues of accessibility and affordability.

In 2013, the then-ruling Conservative government overhauled Canada's medical marijuana program, requiring that patients buy their cannabis from licensed producers through a mail order system, instead of growing their own marijuana.

That prompted a group of British Columbia residents to take Canada to court over the ban, which they said was unconstitutional. Last month, a federal court judge in Vancouver agreed with them, striking down the ban.

Medical marijuana is a separate issue from recreational marijuana in Canada. The Liberals, who vaulted to power in October, have pledged to legalize and regulate the recreational use of cannabis, though the time frame remains unclear.

Shares of medical marijuana producers were mixed on Thursday, with Canopy Growth Co closing up 2.36 percent at C$2.60, OrganiGram Holdings flat at 76 Canadian cents and Aphria Inc down 1.29 percent to 77 Canadian cents.

(Additional reporting by David Ljunggren in Ottawa; Editing by Dan Grebler)