SYDNEY, Australia — Australia’s capital on Wednesday became the first jurisdiction in the country to legalize the recreational possession and cultivation of marijuana, a move that runs counter to federal laws that can carry prison terms for personal use of the drug.

Passage of the measure, which came after months of debate over policy, legal and health issues, echoed efforts in the United States, where more than 10 states have legalized recreational use of marijuana even as it remains illegal under federal law.

The new law in the Australian Capital Territory, which encompasses the capital city, Canberra, allows residents over 18 to possess up to 50 grams of dried marijuana and grow two plants per person or four per household at a time. Supplying the drug to other people remains illegal.

“The passage of this legislation is an Australian first,” Michael Pettersson, a Labor Party lawmaker who was a driving force behind the bill, said in a statement. “It will work to reduce the harm of drugs in our community by reducing the stigma of drug use and encouraging people to seek help without fear of arrest.”