The 28-year-old has now agreed a one-year contract with the Rossoneri.
A statement from AC Milan read: “Mathieu Flamini, Rossonero since 2008 and also next season.”
The news of the new deal comes less than a week after AC Milan vice-president Adriano Galliani confirmed that Flamini was being released.
“The time has expired for Flamini and we have already told his lawyer that we will not wait any longer,” Galliani told Gazzetta dello Sport.
Flamini had been linked with the likes of Malaga and Napoli.