LONDON — “The Cuckoo’s Calling,” a debut detective novel published here in April, was not a huge commercial success, but it got great reviews.

Readers described it as complex, compelling and scintillating. They compared the author — a former military police investigator writing under the pseudonym Robert Galbraith — to P. D. James, Ruth Rendell and Kate Atkinson. They said the book seemed almost too assured and sophisticated to be a first novel.

As it happens, they were right. In one of the great publishing coups in recent years, “The Cuckoo’s Calling,” which has sold just 1,500 copies in Britain so far, turns out to have been written not by an ex-British Army officer, or by a new writer, or even by a man. Instead, its author is J. K. Rowling, whose Harry Potter novels have made her one of the world’s best-selling, and best-known, authors.

Ms. Rowling was unmasked by The Sunday Times of London, which, acting on an anonymous tip, embarked on a sleuthing mission of its own and published the result on Sunday. In the article, Ms. Rowling confessed to the ruse and spoke somewhat wistfully of her brief, happy foray into anonymous authorship.