Albert Einstein, one of the most highly-regarded scientists of all time, was ashamed of his tangled love life and the failure of his two marriages, it has emerged.

In letters Einstein wrote contemplating the death of his closest friend Michele Besso in 1955, the scientist regretted his inability to connect with a wife, something he said he had failed at twice.

"This gift of a harmonious life is seldom paired with such a sharp intelligence... But what I most admired in him as a man was the circumstance that he managed to live for many years not only in peace but in lasting consonance with a wife — an undertaking at which I twice rather shamefully failed," the physicist, who developed the theory of relativity, wrote.

The notes are part of a trove of more than 50 newly unearthed letters Einstein wrote months before his death. They are going to be sold by auction house Christie's in London next month.

The correspondence highlights Einstein's unhappy love situation, his estrangement from his children and his devotion to his work, which he sometimes used a refuge to escape from his difficult personal life.

Einstein married his first wife, Mileva Marić, in 1903. The pair had two children and stayed together until 1919. They divorced as Mileva suspected her husband was having affairs.

Einstein married his first cousin, Elsa Löwenthal, the same year.

"His second wife was mortally ill and it is pretty clear that the reason he was so preoccupied [with work] is that when he was not sitting in his study he was walking around the house completely lost and crying," said Thomas Venning, head of books and manuscripts at Christie's.

"He was not a good husband but he was devoted to her. Mathematics was a refuge from the difficulties and concerns."

The 56 letters also contain details of the relationship Einstein had with suspected Soviet spy Margarita Konenkova. It is believed she had been been tasked by her government with discovering details about the US atomic tomb project.

The six most valuable letters are being auctioned on 12 July. The rest will be sold by Besso's descendants online, The Times said. Estimates range from a few hundred pounds to £150,000.