Citing chronic pain, Missy Franklin announced her retirement Wednesday from competitive swimming. The 23-year-old, whose four gold medals and effervescent personality made her a star at the 2012 Olympics, went on to win another gold at the 2016 Rio Games despite beginning to suffer “intense shoulder pain” a few months earlier.

“Swimming has been, and always will be, a big part of my life and I absolutely plan to stay involved in what I believe is the best sport in the world, just in a different way,” Franklin wrote in an essay published by ESPN. “I hope to continue to inspire others to be their best, both in and out of the pool, and I’m truly excited about this next chapter and how my relationship with the sport will continue to change and grow.”

Nicknamed “The Missile,” the 6-2, 170-pound Franklin was just 17 when she made London her personal stage, becoming the first American woman to win four golds in a single Games. She took the 100- and 200-meter backstroke events, setting a world record in the latter competition, and was part of victorious U.S. teams in the 400 medley and 800 freestyle relays.

Franklin also won a 2012 bronze in the 400 freestyle relay and just missed the podium in two other events, finishing fourth in the 200 freestyle and fifth in the 100 freestyle. She followed that up with six gold medals at the 2013 world championships in Barcelona, but by the time she got to Rio, she was struggling with severe physical limitations that affected her emotionally, as well.

During a meet in April 2016, Franklin said in her essay, she “had to be pulled” after incurring a shoulder injury in warmups. “I had never experienced that kind of pain before and I began to completely unravel,” she said, adding that she experienced “depression, anxiety and insomnia” as she prepared for the Rio Games.

Franklin ended up failing to qualify for the finals of her two individual events at those Olympics, the 200 freestyle and the 200 backstroke, but she earned a gold by swimming for the United States during a preliminary heat of the 800 freestyle relay.

“Looking back, surviving through those eight days in Rio was the greatest accomplishment of my career,” she said Wednesday. “I was able to stay true to who I was as much in failure and disappointment as I had been in winning and being the best in the world.”

“Maybe her career wasn’t as long as we would have wanted and maybe it wasn’t the destination we thought, but when you think about five Olympic gold medals in two different Olympics, that ranks up there with some of the best,” Franklin’s youth coach, Todd Schmitz, told ESPN. “You have to keep the big picture in perspective. For three years she caught lightning in a bottle. Most athletes spend the majority of their careers searching for that sweet spot.”

Franklin charted an unconventional course to an elite swimming career, sticking with her club team and coach through high school in Aurora, Colo., before choosing to attend college instead of turning pro. She expressed no regrets Wednesday over that decision, saying that competing for the California Golden Bears “was one of the greatest honors and privileges I’ve had as an athlete and a person” and that the “teams I was able to be a part of in 2014 and 2015 taught me more than I can begin to say.”

“People would sometimes laugh when I said I wanted to swim in college because I knew I would meet my future bridesmaids on my team and that they would become my family for life,” Franklin wrote. “Well, I did meet them. One maid of honor and three bridesmaids, to be exact.”

Unfortunately, surgery performed on both of her shoulders a few months after the 2016 Games failed to solve her issues, nor did a move earlier this year from Cal to the University of Georgia. Franklin was hoping “a new and different environment” would help, but “nothing was working” and she was eventually faced with the prospect of another medical procedure, with even that option representing no more than “a long shot.”

“When I heard the word ‘surgery,’ I immediately broke down because I already knew my answer: no,” Franklin said. “I’ve been in too much pain, for too long, to go through another surgery with a longer recovery time and no guarantee it would even help.”

“I began to realize that my greatest dream in life, more so than Olympic gold, has always been becoming a mom,” she added. “Swimming had been such a huge part of my life for as long as I could remember, but it was not my entire life. I still have dreams, goals, aspirations and intentions I plan on living out every day of my life.”

Franklin announced in September that she was engaged to former University of Texas swimmer Hayes Johnson. She retires as the current world record-holder in the 200 backstroke, as well as a member of the U.S. women’s world record-setting 400 medley relay.

Read more from The Post:

She started Masters swimming at 46. She died with more records than Michael Phelps.

MLB, Cuban Baseball Federation reach agreement; Trump administration signals it has issues with deal

How the Redskins’ new long snapper met his Olympic gold medalist wife, Shawn Johnson

There’s no need to be cynical just because LeBron was mic’ed while giving his son a pep talk