NEW YORK (AP) — James Gunn may have been fired from Marvel’s “Guardians of the Galaxy,” but DC Comics will welcome him with open arms.

Warner Bros. on Tuesday confirmed that Gunn will write the script to the studio’s next installment of “Suicide Squad,” the DC supervillain team-up franchise. In July, Disney fired Gunn after jokes involving rape and pedophilia he wrote years earlier on Twitter resurfaced.

The creative force between the two hugely popular “Guardians” films, Gunn’s firing prompted its own backlash. The cast issued a statement of support for their writer-director, imploring Disney to reinstate him.

But instead, Gunn will take over “Suicide Squad,” the franchise led by Will Smith, Margot Robbie and Jared Leto. The first film, written and directed by David Ayer, earned $747 million in 2016 but drew withering reviews. Gunn is expected to take an entirely new approach, and potentially direct the new “Suicide Squad” installment.

Gunn’s tweets, largely from 2009-2012, received renewed attention after Gunn’s criticism of President Donald Trump prompted far-right propagandists Mike Cernovich and Jack Posobiec to comb through Gunn’s social media history. Gunn apologized.

“My words of nearly a decade ago were, at the time, totally failed and unfortunate efforts to be provocative,” said Gunn. “I have regretted them for many years since — not just because they were stupid, not at all funny, wildly insensitive, and certainly not provocative like I had hoped, but also because they don’t reflect the person I am today or have been for some time.”

The “Suicide Squad” job is the first Gunn has taken since departing “Guardians,” for which he had been expected to make a third film.

Gunn gives Warner Bros. and DC Comics one of the most fan boy-approved voices in comic book films at a time when Warner Bros. is remaking much of its superhero operations. Gunn’s witty, irreverent sensibility turned Marvel’s “Guardians of the Galaxy” from little-known minor characters into one Disney’s most acclaimed and bankable franchises. The first “Guardians” grossed $773 million and the sequel grossed $863 million.