The OC's Ben McKenzie to star in Fox's Batman prequel Gotham

The actor will play Detective James Gordon in the series written by Bruno Heller

In The OC he played brooding bad boy Ryan Atwood – and now Ben McKenzie has landed a leading role in Fox’s Batman prequel.

The 35-year-old actor is to play Detective James Gordon in the upcoming television series Gotham, which tracks Gordon’s rise through the ranks of the Gotham City Open Police Department.

McKenzie will take on the role, which was made famous by Gary Oldman in Christopher Nolan’s Batman trilogy, in the series written and executive produced by The Mentalist creator Bruno Heller.

The actor took to Twitter to express his excitement.

“All I can promise is I will do my best not to screw this up. Can't wait to get to work,” he tweeted.

Speaking at the Television Critics Association's winter press tour, Fox entertainment president Kevin Reilly said that while the series will focus on Gordon’s struggles, Gotham will be an origin story for Batman.

"We will follow Bruce Wayne right up until the point where he gets interesting,” she said.

Fans can expect many of the franchise’s most iconic characters to feature in the series, including The Joker, Riddler, Penguin and Catwoman.

"It's Gotham teetering on the edge," said Reilly. "This is all of the classic Batman characters." 

Gotham is currently in production, with a pilot to be followed by a full series.

It is not the first time McKenzie has worked with Heller.

In 2013 he appeared on the passed-over CBS pilot Advocates.

More recently he has been seen on cop show Southland, but the series was cancelled last year due to poor ratings.