Electric shock collars for cats and dogs will be banned in England, the government has announced.
The training devices deliver up to 6,000 volts of electricity or spray noxious chemicals to control animals' behaviour.
Environment secretary Michael Gove said this causes unacceptable "harm and suffering".
Wales and Scotland have already taken steps to prevent the use of electric collars.
Animal charities, many of which had campaigned for the change in the law, welcomed the move.
However, some supporters of the controversial collars accused Mr Gove of making a "complete 180" after his department initially suggested there was insufficient evidence for a ban earlier this year.
A survey by the RSPCA found that 5% of dog owners reported using shock collars, suggesting that hundreds of thousands of animals would be affected by the ban.
While it supported a ban, the RSPCA criticised the decision to continue to allow electric containment fences.
A spokeswoman said: "In modern day society there is no excuse or need for the use of devices which can compromise cat and dog welfare, especially when humane and viable alternatives to training and containing dogs and cats are available."
The Dogs Trust said that electric collars could send shocks of 100 to 6,000 volts for up to 11 seconds at a time.
Dr Rachel Casey, director of canine behaviour and research at the Dogs Trust: "Scientific research has demonstrated that electronic devices which deliver an aversive stimulus have a negative impact on dog welfare, so this ban will have a major positive impact for dogs in the UK."
A ban on the devices was backed by 74% of people in a 2014 poll by the Kennel Club.
The dog welfare organisation said a ban would ensure that pets were trained with "positive methods, free from pain".
The announcement follows a government consultation, in which half of the 7,000 responses said they did not want to see containment fences banned.
Mr Gove said: "We are a nation of animal lovers and the use of punitive shock collars cause harm and suffering to our pets."
He urged pet owners to use "positive reward training methods" instead.