The editor of The Times has apologised to a blog-writing detective who was unmasked by a former reporter of the newspaper who allegedly hacked his email.

James Harding told an inquiry into British press standards that he "sorely" regretted the intrusion and expected "better of The Times".

Detectives are investigating claims that the journalist, Patrick Foster, accessed the email of detective Richard Horton in 2009 to unmask him as the author of the anonymous NightJack blog about the workings of the police.

The case has attracted scrutiny because The Times' sister paper, theNews of the World, was closed in July amid a public outcry when it emerged that the Sunday tabloid had hacked the voicemail of a girl who was later found murdered.

Harding admitted to the inquiry last month that the Rupert Murdoch-owned Times had issued one of its reporters with a formal warning for professional misconduct because he had gained unauthorised access to an email account.

The inquiry has heard that The Times fought a High Court battle to name Horton as the writer of the NightJack blog after the reporter told his managers he had tried to access an email account.

Foster no longer works for The Times.

"In the last couple of weeks I have learned a great deal more about what happened in this incident," said Harding, who was recalled to the inquiry to give evidence on Tuesday about the hacking claims.

"As editor of the paper, I am responsible for what it does and what its journalists do.

"So I want to say at the outset that I sorely regret the intrusion into Richard Horton's email account by a journalist then in our newsroom.

"I am sure that Mr Horton and many other people expect better of The Times. So do I.

"So on behalf of the paper, I apologise."

Prime Minister David Cameron set up the inquiry, known as the Leveson Inquiry, to examine the culture, ethics and practices of the press after the phone hacking scandal at the News of the World.