The Italy striker impressed in his first two seasons in Ligue 1, scoring 33 goals in 51 appearances in France's top flight.
However, he has failed to find the net in a difficult few months under Patrick Vieira this term and was encouraged by the head coach to consider his future while he was left out of the squad for eight matches in all competitions.
The 28-year-old former Inter, Manchester City and Liverpool forward has now joined Marseille until the end of the campaign for a reported fee of €3million – his contract with Nice having been terminated by mutual consent.
He could make his debut in Friday's clash with Lille at the Velodrome.
Rudi Garcia's side have struggled for goals in a poor recent run of form, with a 1-0 victory at Caen ending a nine-match sequence without a win in all competitions that included a humiliating Coupe de France exit at the hands of fourth-tier side Andrezieux.
Playmaker Dimitri Payet suffered a sprained knee ligament in the win at Caen that will rule him out for three weeks.