After Putin first recognized the breakaway republics in eastern Ukraine two weeks ago and invaded the country two days later, his actions have been questioned by the outside world.

For example, former US Secretary of State Condoleezza Rice, who has met with Putin several times, has said he seems to have become erratic.

But Abbas Galyamov, who for three years was part of Vladimir Putin's staff of speechwriters, describes his former boss as "extremely logical".

- Of all the people I have met in my life, Putin is probably the last I would describe as crazy, he says.

"Did not count on war"

Today, Abbas Glyamov is an independent political analyst and says that Putin's actions will be more logical if you look at the situation at home.

According to Galyamov, the war is not so much about Ukraine and NATO as about Putin's declining popularity in Russia.

- When Russians think about domestic politics, they are no longer on his side.

To regain the interest of the people, he had to create tension.

As a drug addict who constantly needs a bigger kick, he needs to create more and more tension in the conflict.

And it unfortunately works.

When he delivered his demands to NATO, his opinion figures went up.

But according to Abbas Galyamov, Putin did not expect a war.

- I think he wanted to get as close to the war as possible.

He thought it would be over before the West had time to react, but he did not expect Ukraine to resist so much.

"Putin is desperate for a solution"

He believes that Putin is now in desperate need of a solution that he can present as a win in Russia, before public opinion turns to him.

- It could be that Ukraine agrees not to join NATO, that it recognizes the two breakaway republics or some form of legislation to protect the Russian language.

Russians are willing to see increased tensions, but they are not willing to see blood spilled and they are definitely not willing to live in poverty which is what the sanctions will lead to.

Hear more about how Abbas Galyamov thinks Putin reasons in the clip above and see more about the rational or irrational in Putin's actions in the Foreign Office: Putin's last battle?

in SVT Play from 19.30 and in SVT2 at 22.00.