The mystery has been solved.

A British law firm admitted Thursday that one of its partners inadvertently revealed that J.K. Rowling had authored a mystery novel, The Cuckoo’s Calling.

The Sunday Times newspaper revealed over the weekend that the Harry Potter author had penned the book under the pseudonym Robert Galbraith.

The newspaper said it had received a tip-off on Twitter, and there was speculation that Rowling or her publisher were behind the revelation — which has sent sales of the thriller skyrocketing.

But law firm Russells said Thursday that one of its partners, Chris Gossage, had let the information slip to his wife’s best friend, Judith Callegari — the woman behind the tweet. Her Twitter account has now been deleted.

A phone message left for Callegari was not immediately returned.

Russells said in a statement that “we apologize unreservedly” to Rowling.

It said that while Gossage was culpable, “the disclosure was made in confidence to someone he trusted implicitly.”

Russells, a specialist in entertainment law, said it had informed Rowling and her agent once it learned what had happened.

“We can confirm that this leak was not part of any marketing plan and that neither J.K. Rowling, her agent nor publishers were in any way involved,” the statement said.

The Cuckoo’s Calling had garnered good reviews but sold in the hundreds of copies since being published in April, ostensibly as the first novel of a former soldier. Since Rowling was outed as the author, it has topped best-seller lists, with publisher Little, Brown and Company commissioning a new printing of 300,000 copies.

The Sunday Times followed up its tip-off by asking language experts to compare the style of The Cuckoo’s Calling to work by Rowling and leading crime writers. Patrick Juoma, a computer science academic at Duquesne University in Pittsburgh, used specialist style-comparison software to identify Rowling as the likely author.

Rowling said that “only a tiny number of people knew my pseudonym and it has not been pleasant to wonder for days how a woman whom I had never heard of prior to Sunday night could have found out something that many of my oldest friends did not know.”

“To say that I am disappointed is an understatement,” she added. “I had assumed that I could expect total confidentiality from Russells, a reputable professional firm, and I feel very angry that my trust turned out to be misplaced.”