Flanagan came through Liverpool's youth ranks to make 40 appearances in the top flight, with his best run of form coming in the 2013/2014 season when the Reds came close to winning the Premier League title under Brendan Rodgers.
Flanagan, who won one cap for the England national team, spent time on loan at Burnley and Bolton Wanderers and also played for Rangers, Charleroi and HB Koge, where his contract was terminated this summer.
“Unfortunately after careful consideration I have made the toughest decision I’ve ever had to make: to retire from professional football,” Flanagan wrote on Instagram.
“The last 14 months I have tried everything possible to recover from my most recent knee surgery.
“However, ultimately my long-term health has to come first, so following medical advice the right thing for me to do now is retire from the game.
“My dream as a boy was to grow up and play football for a living and today I’m so proud to say I lived that dream.
“Not only playing and captaining my boyhood club Liverpool but also making an appearance for my country, those memories created will last a lifetime and I’m so grateful that I have had the experience many others can only wish for.
“I would like to thank everyone for their support over my journey, especially my girlfriend, family, team-mates, coaches and agents.
“I feel very fortunate to have you all in my life.
“Also, a massive thank you to the fans of Liverpool, Glasgow Rangers, Burnley, Bolton, Charleroi and HB Koge who have supported me throughout.
“You have been great and have made my journey an unforgettable one!
“I will now begin the next chapter of my football journey and I’m excited about what the future brings.
“See you soon, Flanno.”