Martinez spent 9 years with the Bavarian team, during which he won many titles with more than one coach.
“Bayern and Javi Martinez say goodbye and thank you from the bottom of their hearts, after nine years of success together,” the club said in a statement.
“The club and the player have agreed amicably not to extend the contract, which expires on June 30,” the statement added.
With Bayern, Martinez won 23 championships, most notably the Champions League on two occasions.
However, his role became marginal last season, as he participated in only 28 matches, most of them as a substitute.
Last summer, Athletic Bilbao tried to sign former Bayern Munich player Javi Martinez.
The Spanish newspaper “Marca” reported at the time that Bilbao had already reached an agreement with Martinez, and tried to persuade Bayern to sell the Spanish midfielder, to no avail.
The report stated that Bilbao offered 10 million euros for the player, but Bayern wanted 12 million euros to give up Martinez.
Martinez, 32, is good at playing in the center of defense and midfield, and he played for Bilbao between 2006 and 2012, and led him to the European League final under Marcelo Bielsa.
In the same summer, Martinez moved to Bayern Munich for 40 million euros, which was the value of the penalty clause in his contract at the time.