The government is to ban unethical puppy and kitten farms in England, pledging to end the trade of unscrupulous breeders who keep animals in filthy and cramped conditions and force some to be pregnant many times over.

The environment secretary, Michael Gove, announced on Wednesday that a ban on third-party puppy and kitten sales in England would be introduced. The regulation will mean anyone wanting to buy or home a puppy or kitten will have to deal directly with the breeder or rehoming centre. The proposed rule would also effectively prevent the sale of puppies and kittens in traditional pet shops.

Breeders will only be able to sell puppies they have personally bred; and online sellers will have to publish their licence number and the pet’s country of origin and country of residence.

The scandal of puppy farms has come to light in recent years, with examples of unscrupulous dealers rearing hundreds of animals in cramped conditions with poor care, taking advantage of the high prices available from pet-owners, especially for sought-after breeds.

Theresa May first spoke of an intended crackdown on “battery dogs” in December, in the wake of the Lucy’s Law campaign by a coalition of animal rights charities.

Lucy’s Law campaign was named after a severely malnourished King Charles spaniel who was rescued from a breeding site. She had been forced to breed several times a year and her puppies were taken away after just four weeks – half the recommended time.

Gove said the plans would tackle the early separation of puppies and kittens from their mothers, an act that could lead to serious health problems and lack of socialisation by the animals.

“A ban on third-party sales will ensure the nation’s much loved pets get the right start in life,” he said. “People who have a complete disregard for pet welfare will no longer be able to profit from this miserable trade.”

The government will consult this autumn on the proposed ban on third-party puppy and kitten sales in England. May previously said she had a personal stake in the new law, having owned puppies as a child – a poodle called Tassle and a mongrel named Lucky.

The government is also bringing in harsher sentences of up to five years imprisonment for anyone convicted of animal abuse. Breeders will need a licence to sell three or more litters a year and anyone selling online will have to display a licence number.

Marc Abraham, of PupAid, said irresponsible breeders in the UK and abroad used third parties to hide from buyers, who often bought dogs in good faith, having no idea of the conditions of the puppy’s birth. “By banning third-party sellers, Lucy’s Law will ensure all breeders are accountable, making it the first major step in tackling puppy farm cruelty,” he said.

David Bowles, assistant director of public affairs at the RSPCA, said: “We believe it’s vital to crackdown on this underground trade to provide much needed protection to dogs and people, and welcome an end to the third-party sales of puppies.

“Coupled with the new licensing regime and proper enforcement, we believe the new system will help ensure better health and welfare for dogs, and will better protect people from being duped by unscrupulous sellers.”

Some called on the government to go further. Animal sanctuaries are not included in the new regulations, and currently sanctuaries, rescue and rehoming centres can be set up without oversight. Paula Boyden, veterinary director at Dogs Trust, said: “To be effective, a ban needs to be supported by some key additional measures, such as regulating rehoming organisations, which there is still time to introduce. This would close off other loopholes.”

Jo Platt, a Labour MP who has campaigned on the issue, pointed to her own research showing that only 18% of rescue centres were regulated through existing voluntary guidelines:

“Figures released to me under the Freedom of Information Act clearly show an extremely worrying picture across the country with the vast majority of animal rescue homes facing no regulation at all. From my encounters with many animal sanctuaries I know that nearly all of them hold high standards and only have the best interests of the animals they care for. However, these high standards should be imposed across the rescue sector.”