WASHINGTON — It was early December when the Central Intelligence Agency began to suspect it had suffered what it regarded as an embarrassing computer breach.

Investigators for the Senate Intelligence Committee, working in the basement of a C.I.A. facility in Northern Virginia, had obtained an internal agency review summarizing thousands of documents related to the agency’s detention and interrogation program. Parts of the C.I.A. report cast a particularly harsh light on the program, the same program the agency was in the midst of defending in a prolonged dispute with the intelligence committee.

What the C.I.A. did next opened a new and even more rancorous chapter in the struggle over how the history of the interrogation program will be written. Agency officials began scouring the digital logs of the computer network used by the Senate staff members to try to learn how and where they got the report. Their search not only raised constitutional questions about the propriety of an intelligence agency investigating its congressional overseers, but has also resulted in two parallel inquiries by the Justice Department — one into the C.I.A. and one into the committee.

Each side accuses the other of spying on it, with the Justice Department now playing the uneasy role of arbitrator in the bitter dispute. “It’s always been a dicey proposition to be investigating Congress,” said W. George Jameson, a C.I.A. lawyer for decades. “You don’t do it lightly.”