LONDON — Former Prime Minister Tony Blair has said that he couldn’t stand up to Britain’s media tycoons while in power, telling an official media ethics inquiry that doing so could have dragged his administration into a political quagmire.

Blair’s testimony Monday, briefly interrupted by a heckler who burst into the courtroom to call him a war criminal, shed light on the canny media strategy used to create the “New Labour” image that repackaged his party as more mainstream and business friendly, bringing it back to power after 18 years in opposition.

Blair, who was premier from 1997 to 2007, enjoyed strong press support in his early years, including backing from media mogul Rupert Murdoch’s influential newspapers. But he found himself isolated near the end of his decade in power due in large part to his unpopular decision to join the U.S.-led invasion of Iraq.

The greying ex-prime minister said he long had concerns about what he once described as the “feral beasts” of the media but had to tread carefully where press barons were concerned.

“I took a strategic decision to manage these people, not confront them,” he told Lord Justice Brian Leveson, who is leading the inquiry. “I didn’t say that I feared them … (but) had you decided to confront them, everything would have been pushed to the side. It would have been a huge battle with no guarantee of winning.”

Leveson’s inquiry was set up following revelations of phone hacking at Murdoch’s News of the World tabloid, a scandal which has raised questions about whether top politicians helped shield Murdoch — and the media in general — from official scrutiny.

Blair’s time at the top has come under particular scrutiny because of the unlikely — and mutually beneficial — alliance the media-savvy prime minister forged between his left-wing Labour Party and Murdoch’s News Corp.