The ACT Labor government has banned sow stalls and battery cages, in what it says is the most far-reaching legislation in the country.
The government supported Greens minister Shane Rattenbury's legislation, which was part of his deal to become a minister in the Gallagher government.
Mr Rattenbury said it had been a long road to the ban and it sent an important message to the rest of the country.
''To ban these elements of factory farming gives me great joy but I understand there is more to be done,'' he said.
He had received complaints from people saying the legislation did not go far enough, as there were other animal cruelty and factory farming practices in the ACT.
Nationally, about 70 per cent of laying hens, or 11,000 hens, were still kept in battery cages, in spaces often no bigger than a piece of A4 paper, with no room to stretch their wings, turn around, scratch, perch or show other natural behaviours, he said.
"These are living feeling creatures capable of experiencing fear, pain and distress. I find these statistics shocking.''
While there were no intensive piggeries in the ACT, sow stalls were used in piggeries just over the border.
Sow stalls could drive pigs insane, resulting in pressure sores and lameness, he said.
His legislation also outlaws the practice of trimming or removing chickens' beaks, with fines of up to $7000 for an individual or $35,000 for a corporation for breaches.
No one from Labor spoke in Tuesday's debate.
The Liberals voted against the ban, deputy leader Alistair Coe saying it demonstrated that Labor's agenda had been hijacked by the extreme Greens.
Given the ACT had no intensive pig farms nor battery egg farms, the bill was redundant, he said.
He asked whether the government would next try to ban commercial whaling or nuclear power generation in the territory.
He dismissed the legislation as nothing more than Greens grandstanding.
The ACT Greens have tried five times previously to ban battery cages, each time rejected by Labor and Liberals, which were reluctant to move against the Pace Farm battery farm at Parkwood in Canberra.
But Pace stopped producing battery eggs after the site was vandalised in 2012 and now has a $7.5 million land deal with the government to convert to barn eggs.
Mr Rattenbury's legislation defines battery cages as cages that do not allow the hens to fully stretch, perch, access litter and lay eggs in a nest. It does not apply to backyard chicken owners who use the eggs for their own consumption.
It also outlaws the practice of trimming or removing chickens' beaks.
It outlaws stalls and farrowing crates (used while pigs are pregnant and after they give birth) and says pigs must be kept in appropriate accommodation - able to turn around and stand up without difficulty, have a clean and comfortable place to lie down, have access to the outdoors, and see any other pigs.
Mr Rattenbury said the law was the culmination "of many years of work that sets the ACT at a high benchmark".
"This legislation is very clear," he said. "You can still produce eggs and pork in the ACT but you need to do it in a way that is humane ... Hopefully we can encourage the rest of the country to start to follow suit."
Tasmania moved to ban sow stalls and battery eggs at the end of last year. The battery hen ban applies to new operators and the sow stall ban is to be phased in over three years.
Animals Australia welcomed the move. Campaign director Lyn White said it set a significant precedent for other states to follow.
Animal protection group Voiceless said: "This is a major step forward for animal protection. This act recognises that the quality of these animals' lives matters, that they are not machines, but sentient creatures who experience extreme pain and stress when raised in intensive conditions and that the law should protect them from suffering.
"What is needed next is a nationally consistent approach to a ban on sow stalls, farrowing crates, battery cages and other such cruel and inhumane factory farming processes."
- with Steve Jacobs