NEW YORK (AP) — Months after being fired over old tweets, James Gunn has been rehired as director of “Guardians of the Galaxy Vol. 3.”

Representatives for the Walt Disney Co. and for Gunn on Friday confirmed that Gunn has been reinstated as writer-director of the Marvel franchise he has guided from the start. Gunn was fired last July over tweets from nearly a decade ago in which Gunn joked about subjects like pedophilia and rape.

Gunn earlier apologized for the tweets, which he called “unfortunate efforts to be provocative.” Disney Chairman Alan Horn at the time said Gunn’s words were inconsistent with the studio’s values. The comments, made from 2008 to 2011, were brought to light by far-right propagandists Mike Cernovich and Jack Posobiec who combed through Gunn’s social media history after Gunn’s criticism of President Donald Trump.

But Gunn’s dismal was passionately protested by many. Fan petitions circulated online. The “Guardians” cast, including Chris Pratt, Bradley Cooper, Zoe Saldana, Vin Diesel and other stars, supported Gunn in an open letter. “Although I don’t support James Gunn’s inappropriate jokes from years ago, he is a good man,” Pratt said.

Gunn has since signed on to write and direct the next installment of Warner Bros.’ “Suicide Squad” for the Marvel rival DC Comics. That film is to shoot in the fall and be released in August 2021.

A Disney spokesman declined to comment on when “Guardians 3” might go into production. The first two films have made more than $1.5 billion in worldwide ticket sales.

Deadline first reported Gunn’s rehiring.