* Defence minister ousted after corruption scandal
* Serdyukov broke codes of honour and patronage
* Kremlin rivalries and web of patronage persist
By Thomas Grove and Timothy Heritage
MOSCOW, Nov 8 Viktor Zubkov was the friend Russian President Vladimir Putin turned to when he wanted help blowing out his birthday candles 12 years ago.
At the time, Zubkov was an obscure tax man but had already forged the close relationship with Putin on which the political career of Russia's defence minister may have foundered this week in a tale of alleged corruption, adultery and Kremlin rivalries.
By 2007, Zubkov had become prime minister and rising with him was Anatoly Serdyukov, whose appointment as defence minister the same year cannot have been hindered by his marriage to Zubkov's only daughter Yulia.
Serdyukov, now 50, appears, however, to have made a politically fatal error by falling out with his patron after his marriage hit the rocks.
It was Serdyukov who, according to some Russian media, opened the door to police in his bathrobe and slippers when they launched an early-morning raid last month on the apartment of his 33-year-old female neighbour, one of his former employees.
The raid, part of an investigation into a nearly $100 million corruption scandal, was soon splashed across Russian newspapers and Serdyukov's job was on the line.
A hastily arranged meeting with Putin the day the news broke failed to save him.
After years of loyalty, he had become a political liability to the president, who announced his dismissal in a televised meeting with his successor on Tuesday.
"The number of violations, and we are talking about violations everywhere, was so great that his presence was no longer acceptable," former Foreign Minister Igor Ivanov said on the sidelines of a conference, making clear the corruption investigation was not the only cause of Serdyukov's downfall.
His main mistake, in Putin's and Zubkov's eyes, probably lay elsewhere.
"Serdyukov's real mistake was that he broke the golden rule of loyalty to the family, his political family," said a source close to the government.
WEB OF INTRIGUE
Serdyukov's ouster says much about the tacit rules of Russian politics, where loyalty and old alliances are sacrosanct and unchanged in Putin's third term.
Among the 21 guests Putin invited to his birthday party in 2000 at one of his favourite restaurants outside his home town of St Petersburg, many, including Zubkov, have reaped the benefits of the president's power.
The Byzantine workings of the Kremlin, with a former KGB agent at its helm, caused the media to see Zubkov's hand in the raid as a way of getting back at Serdyukov for what looked like a betrayal of his daughter and personal patronage.
It also blew the lid on high-level infighting which Putin prefers to keep below the surface. Serdyukov had made many enemies in the Kremlin and armed forces by pushing through reforms, and the knives had been out for him for years.
"Anatoly Serdyukov's removal is a victory for two groups," said Alexei Venediktov, editor-in-chief of Ekho Moskvy radio station.
The first group, he said, was made up of power rivals led by the head of Putin's administration, Sergei Ivanov, who had ceded control of the funds being used for reforming the army since losing the defence ministry post to Serdyukov.
The defence minister in effect channels a quarter of Russia's budget through the defence industry. Russia is the world's second largest arms exporter, and Putin has promised to spend 23 trillion roubles (nearly $730 billion) on the military by the end of this decade.
The second group, he said, was the military lobby that opposed the reforms of the armed forces, the ranks of officers whom Serdyukov liked referring to as 'little green men'. Reforms were due to take more than 100,000 officers out of service.
Prime Minister Dmitry Medvedev muddied the waters further by praising Serdyukov's efficiency after his dismissal, increasing speculation that he and Putin do not see eye to eye and his days as premier may be numbered.
The situation around Serdyukov had become so complicated that the scandal he was drawn into - over sales of defence ministry property to insiders at suspiciously low prices - is not widely seen as the direct cause of his dismissal.
What is not disputed is that, at the age of 71, Zubkov still has the ear of the president in his current role as chairman of the board of directors at state energy firm Gazprom.
"It's the bathrobe and the slippers - it's not corruption (that brought Serdyukov down)," said an adviser to a wealthy Russian businessman familiar with the way Putin's system of patronage works.
Although Reuters sought comment from Zubkov and Serdyukov, as well as his neighbour Yevgeniya Vasilieva, none was immediately available to comment.
CONSTRUCTING THE WEB
Zubkov became close to Putin in the 1990s when they worked together in the city administration in St Petersburg.
The bond tightened as Putin helped secure a senior tax job in St Petersburg for Zubkov, who worked in the 1960s and 70s as a collective farm manager.
In time, Zubkov in turn helped Putin and other friends find land outside Russia's second city to start a dacha, or country house, cooperative, Russian media reported.
The cooperative contained several leading lights associated with Putin - Russian Railways chief Vladimir Yakunin, former Education Minister Andrei Fursenko and top security official Nikolai Patrushev, Kommersant newspaper said.
Other groups of friends and associates who have risen with Putin include former colleagues at Russia's spy agencies and security forces, known as the 'siloviki', and fellow economists and lawyers he knew in St Petersburg such as Medvedev.
As Putin rose, so did Zubkov. By 2004 he was head of a team created to bust financial crimes and stamp out corruption. Three years later he had a brief spell as prime minister, a post he handed to Putin in May 2008 when the president left the Kremlin for four years because of a constitutional term limit.
Zubkov blessed the marriage of his daughter to Serdyukov after the two met in the late 1990s while studying law in St Petersburg, and he gave his son-in-law's career a helping hand.
A former furniture salesman, Serdyukov soon landed a senior job busting tax crimes as Putin brought to heel a group of rich tycoons known as oligarchs who had accumulated vast power and wealth after the collapse of the Soviet Union.
Among them was Russia's richest man, former oil tycoon Mikhail Khodorkovsky, who was arrested in 2003 and later jailed for money laundering and tax evasion. Putin's opponents say the charges were politically motivated but he remains in prison.
A source close to Russia's defence industry said Serdyukov had received Russia's top medal in return for helping dismantle the oil empire Khodorkovsky had created with his company YUKOS.
WHAT WENT WRONG?
Serdyukov's career was by now flourishing and Putin gladly rejected his resignation, offered in 2007, when his father-in-law became the head of the government.
By forcing through deep personnel cuts to modernise Russia's rusting military, Serdyukov won a reputation as one of the few genuine reformers in Russia's upper echelons.
In a sign of Putin's trust, as defence minister Serdyukov carried the nuclear briefcase for communicating with Russia's leaders on activating the country's nuclear arsenal.
But he also gained enemies, who were waiting to pounce.
His vulnerability became apparent when he was publicly drawn into the investigation into Defence Ministry firm Oboronservis on suspicion that it had sold assets to commercial firms at a loss of 3 billion roubles ($95.20 million).
Police said they found valuable paintings, rare antiques and more than 100 expensive rings when they raided Vasilieva's apartment.
It may have been time to get even for Zubkov, infuriated by the breakdown in his daughter's marriage, which sources say took place about a year ago. But others had long been portrayed by media as jealous of Serdyukov.
Among those was Dmitry Rogozin, the ambitious former NATO ambassador who is now first deputy prime minister with responsibility for the military-industrial complex - but not the armed forces' huge budget.
"For the last few months a big fight has been brewing between Serdyukov and Mr Rogozin, which has taken place because while Rogozin has achieved a very high position, in reality, he controls very little money," said defence analyst Alexander Golts.
Rogozin said he had no interest in the job when asked by reporters on Thursday, why he had not been appointed Defence Minister. "I had no such plans," he said.
With Kremlin administration chief Sergei Ivanov also displeased, Serdyukov's days in government were clearly numbered, analysts said.
The respected Vedomosti newspaper said Serdyukov had also made enemies in the FSB security agency, the successor to the Soviet KGB, with plans to create a military police force, which would have limited the security agency's influence.
"There is no grey area with Putin. You are either in it or you are out, and if enough people in Putin's circle think you should be out, then that's where you'll find yourself," said a source close to the Kremlin and the government.
Where the scandal leaves Putin is uncertain. Some analysts suggest he removed a longtime ally only when forced to, and that this is a sign of weakness. Others said he had shown his strength by proving he could easily oust such powerful figures.
Without doubt, by naming another trusted ally as defence minister - former Emergencies Minister Sergei Shoigu - he carefully avoided being seen to reward any of the rival groups that had been pushing for Serdyukov's departure.
"After taking the decision to give up Anatoly Serdyukov, Putin did not make a concession to these groups, instead choosing Sergei Shoigu, who is not linked with any of the groups, as his successor. (He maintained) Balance, so to say," Venediktov wrote in a blog.
That has long been Putin's strategy, playing one group off against another in a balance of power. Six months into his third term as president, Serdyukov's dismissal suggests his system of patronage and power games has changed little.