Protests were held in New Zealand over the decision. (Getty)

Peter Jackson’s “Hobbit” movies will be made in New Zealand after the government struck a deal with Hollywood studio Warner Bros., Prime Minister John Key said Wednesday.

Ending almost two months of uncertainty whether New Zealand would retain its coveted role as author JRR Tolkien’s Middle Earth, Key said the government had agreed to increased financial incentives for the US$500m production.

In return, Warner Bros. would use its marketing clout to promote New Zealand as a tourist destination, Key said after two days of tense negotiations with studio executives at his official residence in Wellington.

“I am delighted we have achieved this result,” Key told reporters. “Making the movies here will not only safeguard work for thousands of New Zealanders, but will also allow us to follow the success of ‘The Lord of the Rings’.”

The producers had threatened to move the “Hobbit” project, a two-part prequel to Tolkien’s “The Lord of the Rings”, elsewhere after a row erupted over union representation for actors on the set.

Key said under the agreement, the government would also introduce legislation Friday clarifying laws covering workers in the film industry, to ensure the project was not threatened by legal action.

The prime minister, who earlier described his discussions with the Warner executives as “hardball”, said he was pleased the issue had been resolved.

“It’s good to have the uncertainty over and have everyone full steam ahead,” he said.