Mahdavikia, whose contract was due to expire at the end of the season, has been allowed to leave with immediate effect, the club said.
The 32-year-old joined Frankfurt in the summer of 2007 from SV Hamburg and was previously at VfL Bochum. He has played 255 Bundesliga games scoring 29 goals.