Credited to New Zealand. Not shown in the sources seen: electric fencing was also being developed and sold in the United States in the 1930s, so this is a New Zealand development, not a sole invention.
How it began
Bill Gallagher was a dairy farmer's son from the Waikato region of New Zealand who built gadgets for farm work from an early age. In the early 1930s, according to the company he founded, a horse named Joe kept using the family car as a scratching post. Gallagher wired the car so that it gave a shock whenever the horse rocked it. The horse stopped, and Gallagher saw that electricity could be used to confine animals.
By 1937, while farming at Horsham Downs, he had developed an electric fence for farmers. He sold battery-powered units and was granted a New Zealand patent. In 1940 he moved to Hamilton East and kept manufacturing the fence there.
How it spread
After the Second World War, Gallagher ran a workshop on Seddon Road in Hamilton with six workers, making gas producers, tractor conversions and farm equipment alongside the battery fence. Gallagher Engineering Limited was established in 1963. His sons William and John joined the firm. William played a major part in exporting to Australia, and that success led Bill Gallagher to look for markets in the United Kingdom.
Who pushed back
For decades the fence could only be run from batteries, because connecting an electric fence to the mains supply was illegal in New Zealand. The law was changed in 1961. Gallagher's business then revised the fence to run on mains power, which became the mainstay of the company he set up two years later.
Where it stands today
The company is still controlled by the family. As of 2019 Sir William Gallagher, the founder's son, was chief executive and executive director of the Gallagher Group. Bill Gallagher remained a director until 1989, was appointed MBE in the 1990 New Year Honours, and died in Hamilton that year. He was inducted into the New Zealand Business Hall of Fame in 2012.