Hugh Jackman has officially closed a deal to play the pirate Blackbeard in Warner Bros. "Pan."

Variety first reported Jackman was in talks to star in the pic that Joe Wright is directing and Garrett Hedlund is also in talks to star in as Hook.

Greg Berlanti is producing from a script by Jason Fuchs. Sarah Schechter will oversee for the studio.

WB had gone to Javier Bardem for the role, but the actor passed and the studio pursued Jackman shortly after that.

While the Australian actor isn't known for playing villains, Jackman has shown the ability to take on the darker roles. His recent perf in WB's "Prisoners" got high praise from critics and though he's not the bad guy in the film, the part is much edgier than his previous roles, even that of the anti-hero Wolverine in the "X-Men" movies.

The pic bows on July 17, 2015. Jackman is repped by WME.

2014 Variety Media, LLC, a subsidiary of Penske Business Media; Distributed by Tribune Content Agency, LLC