It was 1998 when Kenny, a 3-year-old Asian elephant, was brought out to perform during two Ringling Bros. and Barnum & Bailey Circus shows in Jacksonville. He sat out a third show that day but was led into the arena to watch. Kenny died overnight in his stall.

His death triggered a series of events: A whistleblower tipped off People for the Ethical Treatment of Animals, the group said, and it contacted the U.S. Department of Agriculture. The agency eventually brought a complaint that charged the circus with failing to handle Kenny in a way that “did not cause behavioral stress and unnecessary discomfort” and said that handlers made the young elephant perform even after discovering he was sick and needed to be seen by a veterinarian. Eventually, the USDA dropped the complaint and the circus’s parent company agreed to donate $20,000 to Asian elephant organizations.

A year later, the USDA investigated the death of Benjamin, a 4-year-old Asian elephant that refused to get out of a Texas pond during a recreational stop between circus dates.

These are the stories that animal-rights activists have repeated over and over in their lengthy crusade to compel Feld Entertainment Inc. to stop using elephants in the company’s Ringling Bros. and Barnum & Bailey Circus. A year-long Mother Jones investigation detailed disturbing details about the lives of the circus elephants, including disease spread in captivity, premature separation from their mothers and significant time spent chained up.

But Feld Entertainment has also prevailed in the past; in 2014, a legal case dating back 14 years ended with animal-rights groups agreeing to pay a $16 million settlement over unproven allegations of mistreatment of the elephants.

The tension between the two sides — groups that say the elephants are being badly mistreated and the famous circus company that insists its trainers have always treated the animals like their own children — will finally come to an end in 2018, when Feld Entertainment will finish phasing out elephant acts. The 13 elephants touring with the self-billed “Greatest Show on Earth” will join 40 others at the company’s conservation center in Florida. In a statement Thursday, Feld Entertainment said the decision “will allow the company to focus on its Asian elephant conservation programs.”

“We’re not reacting to our critics,” company president Kenneth Feld told the Associated Press, which first reported the news. “We’re creating the greatest resource for the preservation of the Asian elephant.”

The announcement comes after years of controversy, litigation and, more recently, legislation. In December, Oakland joined Los Angeles in banning the use of bullhooks, a tool that resembles a fire poker and is used by trainers to control elephants. The company had previously declared that the circus wouldn’t come to those cities once the bans went into effect.

“We looked across the legislative landscape that was out there and it’s become a patchwork quilt of really unnecessary restrictions and prohibitions around the country,” Feld Entertainment spokesman Stephen Payne said Thursday. He added that the company is in the entertainment business, “not in the business of fighting city hall.”

“The resources that had been put toward fighting these legislative activities could be better spent caring for these animals,” he said.

But the company also took note of public attitudes about circus elephants, Payne said. “We have detected a shift in mood from some of our customers that didn’t necessarily feel comfortable with elephants traveling city to city,” he said.

That’s something animal-rights groups have also taken note of. Humane Society president and CEO Wayne Pacelle called Thursday’s announcement “startling and tremendously exciting.”

“We’ve said all along that the public won’t tolerate the abuse of elephants with sharp bullhooks to get them to perform tricks or the constant chaining of these highly intelligent and mobile animals,” Pacelle said in a statement.

Still, the announcement didn’t completely satisfy some of the organizations that have been at the forefront of the fight with Feld Entertainment.

Noting that the removal of elephants from the circus won’t come until 2018, Delcianna Winders, deputy general counsel for PETA, said: “We’re thrilled with this announcement, but it needs to come much quicker than three years. Three years is too long to wait for animals suffering tremendously.”

The announcement from the circus comes amid heightened attention to the use of animals for entertainment. Last week, SeaWorld reported continued declines in both attendance and revenue at its parks following the 2013 release of the film “Blackfish,” which documents the company’s controversial treatment of killer whales. Months earlier, hundreds of SeaWorld employees were laid off. And in December, SeaWorld’s chief executive resigned.

The fight over Feld Entertainment’s use of elephants has been long and hard-fought on both sides, involving years of costly litigation, local protests and bad press. Winders said it has “really played out on all fronts. It’s very much been a PR thing, because when people see these photos of baby elephants being stabbed with bullhooks, people don’t want to support this.”

PETA has a campaign dedicated to exposing treatment of elephants. In 2009, the organization published a video of “undercover” footage showing elephants being hit with bullhooks. Another video shows Benjamin as a trainer with a bullhook attempts to get him out of the Texas pond where he died. “Oh, God,” the trainer is heard saying.

Celebrities joined the cause, as well, with Alec Baldwin urging a circus boycott in 2012.

Payne, the Feld Entertainment spokesman, said critics of the company’s handling of elephants don’t know what’s involved with taking care of such animals and that trainers put elephants’ needs ahead of their own. “These activist groups continue to make outrageous allegations about our animal care, which is really a disservice to the men and women who spend 24 hours a day, seven days a week taking care of these animals,” Payne said.

Years ago, the American Society for the Prevention of Cruelty to Animals and other groups sued Feld Entertainment over its treatment of elephants and accused the company of violating the Endangered Species Act. But a judge in 2009 ruled that one of the witnesses, a former elephant handler, was a “paid plaintiff” by the groups.

Feld Entertainment in turn sued the organizations — and, in 2012, the ASPCA settled that lawsuit. While admitting no wrongdoing, the ASPCA agreed to pay the company $9.3 million.

That settlement came a year after the USDA fined Feld Entertainment a record $270,000 related to animal cruelty charges. The company agreed to pay the money while admitting no wrongdoing.

ASPCA president and CEO Matt Bershadker said in a statement that Thursday’s announcement by Feld Entertainment was “a tremendous victory for the elephants” and “for everyone who fought for this change, including many advocates and lawmakers in cities around the country.”

PETA’s Winders, who has spent years working on circus-related issues, said the company’s decision, although not perfect, was “only a matter of time.”

“With the increase in pressure with the bans being passed, they’ve seen the writing on the wall,” she said.