"The decision to retire was a very difficult one for me to make," said Melandri. "I'd been thinking about it for some time and, before the Imola race, I finally decided to call it a day at the end of the 2019 season.
"I'm still competitive and I think it's better to stop at this point, while I still enjoy racing, rather than waiting until the enjoyment and the results are more difficult to achieve.
"Since making the decision I feel like a huge weight has been lifted from my shoulders and now that everyone knows this is my final year, I'm even more motivated to push for good results in the final few races."
Melandri last raced in MotoGP in 2015 with Aprilia, but parted ways with the Noale firm after eight races and did not race again until joining Ducati in WSBK in 2017.
He finished runner-up to Valentino Rossi in 2005 (pictured below) and also placed second in the WSBK standings with Yamaha in the 2011 season, which followed the end of his first stint in MotoGP.