George Orwell, the writer who savagely attacked the Big Brother powers of Russian totalitarianism, was spied on for the Soviet Union by a fellow British volunteer during the Spanish civil war, a new book reveals.

Soviet spymasters snooped on the English writer as he became involved in rivalry between communists and Trotskyists. The communists pried into his private life to record that Orwell's wife was probably having an affair with one of his comrades. Orwell's attacks on the corruption of the Russian revolution inflicted much damage on the reputation of the Soviet leaders.

The surveillance of Orwell during the Spanish civil war is revealed in a new biography of the author by Gordon Bowker, published on Thursday. It was during this war that Orwell began to loathe communism, which he satirised in his novels Animal Farm and Nineteen Eighty-Four. Bowker writes that Orwell's experience in Spain "ultimately gave birth to his last two great novels".

In Barcelona, Orwell saw how the communists suppressed their Trotskyist allies to take control of the war against the fascists in what he called "a reign of terror". He was forced to flee Spain as the communists imprisoned their former comrades, branding them traitors.

As a relatively unknown writer, he had volunteered to fight fascism in Spain in 1937 and had joined the forces controlled by the POUM, a revolutionary socialist, anti-Stalinist party affiliated to the Independent Labour party (ILP) in Britain.

It was by chance that Orwell chose the POUM, as he did not fully understand the different political groupings in Spain. But the communists - directed by Stalin - had begun to suppress the Trotskyists and infiltrate spies into the ranks of their opponents. David Crook, a young communist from London, was ordered to spy and report on Orwell, his wife and other members of the ILP contingent. He had been taught the techniques of surveillance by Ramon Mercader, a communist who later murdered Trotsky in Mexico with an ice-pick. According to the book, Crook admits that he took his orders from the Soviet espionage agency, then known as the NKVD and later renamed the KGB, and that Orwell and the other ILP members were "of special interest to me".

He insinuated himself into the ILP office in Barcelona. Soon he had the freedom of the office and, during lunch breaks, stole files and had them photographed in the Russian embassy. He was proud that within a short time, copies of all the files in the office were in the hands of his Russian handlers. Details of his activities are held in the KGB archives, although Orwell's KGB file is still under wraps.

Among his reports was an observation that he was "95% certain" that Eileen Blair, who married Orwell in 1936, was having an affair with George Kopp, another ILP member, whom Bowker describes as "a strange Belgian adventurer". Bowker adds that Crook had been instructed by the Soviets to seek out the existence of affairs, as such information could enable the communists to blackmail vulnerable targets. In a reference to the ruling powers in Nineteen Eighty-Four, Bowker writes that Crook, who subsequently helped to kidnap opponents in Spain, was like a character "straight from the Ingsoc world of spying, intrigue, dissemblance and cold elimination".

Crook passed his reports to Hugh O'Donnell, another communist from London, whose codename was O'Brien. Bowker writes that, although Orwell was oblivious to this, "the fact that the character in Nineteen Eighty-Four who first wins the confidence of Winston Smith and then betrays him is given the name O'Brien must be one of the strangest coincidences in literature".

Orwell appears not to have twigged that the communists were spying on him. However in Homage to Catalonia, his account of his time in Spain, he wrote: "You had all the while a hateful feeling that someone hitherto your friend might be denouncing you to the secret police."

Crook and another English soldier were responsible for briefing the Soviet espionage service about Orwell and his wife. Both were subsequently accused of treason and of being "rabid Trotskyites" by the communists.

Orwell wrote to a friend on his return to England: "Though we ourselves got out all right, nearly all our friends and acquaintances are in jail and likely to be there indefinitely, not exactly charged with anything but suspected of Trotskyism.

"The most terrible things were happening even when I left, wholesale arrests, wounded men dragged out of hospitals and thrown into jail, people crammed together in filthy dens where they have hardly room to lie down, prisoners beaten and half starved."

· George Orwell by Gordon Bowker (Little Brown)