In December 1935, Margaret Sanger, the American birth control activist and sex educator, visited Indian independence hero Mahatma Gandhi and had an absorbing conversation with him.

Sanger was on an 18-city trip to India, speaking with doctors and activists about birth control and the liberation of women.

Her fascinating exchange with Gandhi at his ashram in the western state of Maharashtra is part of a new biography of India's "father of the nation" by historian Ramachandra Guha. Drawing on never-before-seen sources from 60 different collections around the world, the 1,129-page book tells the dramatic story of the life of the world's most famous pacifist from the time he returned to India from South Africa in 1915, to his assassination in 1948.

The biography also provides a glimpse into Gandhi's views on women's rights, sex and celibacy.

In his ashram, Gandhi's efficient secretary, Mahadev Desai, took copious notes of the meeting between the leader and the activist.

"Both seem to be agreed that women should be emancipated, that a woman should be the arbiter of her destiny," he wrote.

But differences quickly arose between the two.

Mrs Sanger, who had opened the first US family planning centre in New York in 1916, believed that contraceptives were the safest route to emancipation.

Gandhi demurred, saying women should resist their husbands, while men should try to curb "animal passion". He told his visitor that sex should be only for procreation.

Mrs Sanger soldiered on spiritedly.

She told Gandhi that "women have feelings as deep as and as amorous as men. There are times when wives desire physical union as much as their husbands".

"Do you think that it is possible for two people who are in love, who are happy together, to regulate their sex act only once in two years, so that their relationship would only take place when they wanted a child?" she asked.

This is where contraception came in handy, she insisted, and helped women prevent unwanted pregnancies and gain control over their bodies.

Gandhi remained stubborn in his opposition.

He told Sanger that he regarded all sex as "lust". He told her of his own marriage, saying the relationship with his wife, Kasturba, had become "spiritual" after he "bade goodbye to a life of carnal pleasure".

Gandhi had married at 13, and taken a vow of celibacy when he was 38 and the father of four children. In doing so, he had been inspired by a Jain seer named Raychandbhai and Russian writer Leo Tolstoy, who became celibate in his later life. (Jainism is an ancient Indian religion of harmlessness and renunciation.) In his autobiography, Gandhi had written how guilt ridden he was by the thought that he was having sex with his wife when his father passed away.

At the end of the conversation with Sanger, Gandhi relented a little.

He said he didn't mind "voluntary sterilisation in the case of man, since he is the aggressor", and that instead of using contraceptives, couples could have sex during the "safe period" of the menstrual cycle.

Mrs Sanger left the ashram unconvinced. Later, she wrote of Gandhi's "appalling fear of licentiousness and over-indulgence". She was deeply disappointed at his failure to endorse her campaign.

It was not the first time that Gandhi had spoken out openly against artificial birth control.

In 1934, an Indian women's rights activist had asked him whether contraceptives were the next best thing to "self-control".

"Do you think that the freedom of the body is obtained by resorting to contraceptives? Women should learn to resist their husbands. If contraceptives were resorted to as in the West, frightful results will follow. Men and women will be living for sex alone. They will become soft-brained, unhinged, in fact mental and moral wrecks," Gandhi had replied.

"For Gandhi, all sex was lust; sex was necessary for procreation. Modern methods of birth control legitimised lust. Far better that women resist men, and men control and tame their animal passions," writes Guha, his latest biographer, in his book Gandhi: The Years That Changed the World, 1914-1948.

Many years later, as Hindu-Muslims riots rocked the southern Noakhali district of the state of Bengal on the eve of India's independence, Gandhi undertook a controversial experiment. He asked his grandniece and ardent devotee, Manu Gandhi, to join him in the bed he slept in.

"He was seeking to test, or further test, his conquest of sexual desire," Guha writes.

Somehow, according to his biographer, Gandhi felt that the "rise of religious violence was connected to his own failure to become a perfect brahmachari [celibate]". Gandhi, who campaigned all his life for interfaith harmony, was appalled by the violence breaking out between Hindus and Muslims in the run up to independence from Britain.

"The connection was a leap of faith, an abdication of reason and perhaps also an expression of egotism. He had come round to the view that the violence around him was in part a product or consequence of the imperfections within him," Guha writes.

Gandhi faced a lot of opposition when he told his associates about the "experiment". They warned him it would soil his reputation and that he should abandon it. One associate said it was both "puzzling and indefensible". Another quit working with Gandhi in protest.

Guha writes that one needs to look beyond "rationalist or instrumental explanations of why men behave as they do" to understand this strange experiment.

For some 40 years by then, Gandhi had been obsessed with celibacy. "Now at the end of his own life, with his dream of an united India in ruins, Gandhi was attributing the imperfections of society to the imperfections of the society's most influential leader, namely himself".

A close associate and admirer of Gandhi later wrote to a friend that from a study of the leader's writings, he found that he "represented a hard, puritanical form of self-discipline, something which we usually associate with medieval Christian ascetics or Jain recluses".

Historian Patrick French has written that although some of Gandhi's unconventional ideas were rooted in ancient Hindu philosophy, "he was more tellingly a figure of the late Victorian age, both in his puritanism, and in his kooky theories about health, diet and communal living".

Clearly, Gandhi's attitudes to women were complex and contradictory.

He appeared to be averse to women making themselves more attractive to men. He, according to Guha, abhorred "modern hairstyles and clothes".

"What a pity," he wrote to Manu Gandhi, "that the modern girl attaches greater importance to following the code of fashion than to the protection of her health and strength." He was also critical of the veil for Muslim women, saying it "harms women's health, they can't get sufficient air and light and they remain disease-ridden."

At the same time, Gandhi believed in the rights of women, and that women were to be fully equal to men.

In South Africa, women joined his political and social movements. He appointed a woman, Sarojini Naidu, to lead the Congress party at a time when political parties in the West had few women leaders. He asked women to protest outside liquor shops. Many women participated in the massive march to protest against the British salt monopoly and the salt tax.

"Gandhi," writes Guha, "did not use the language of modern feminism.

"While strongly supportive of women's education, and open to women working in offices and factories, he thought the burden of child-rearing and homemaking should be borne by women. By the standards of our time, Gandhi should be considered conservative. By the standards of his own time, however, he was undoubtedly progressive."

When India became independent in 1947, this legacy, believes Guha, helped the country get a woman governor and a woman cabinet minister. The work of rehabilitating millions of refugees was led by a group of powerful women. A top university chose a woman as a vice-chancellor, decades before top American universities began choosing women presidents.

Women, says Guha, were as prominent in public life in the India of the 1940s and 1950s as in the US of the same period. This must count as one of Gandhi's important, and not so well known achievements, despite his eccentric "experiments with truth".