Mohandas Gandhi, whose death anniversary falls on Saturday, was an amazing human being. He led his country to freedom and helped destroy the British Empire. Little wonder India worshipped him, and still worships him, as the Mahatma – "Great Soul". In the west he is viewed as a near-perfect combination of compassion, bravery and wisdom.

But Gandhi was also a puritan and a misogynist who helped ensure that India remains one of the most sexually repressed nations on earth – and, by and large, a dreadful place to be born female. George Orwell, in his 1949 essay Reflections on Gandhi, said that "saints should always be judged guilty until they are proved innocent". If only.

Gandhi despised his own sexual desires, and despised sex in any context except for procreation. He preached that the failure to control carnal urges led to complaints including constipation. He believed that sex was bad for the health of an individual, and that sexual freedom would lead Indians to failure as a people. He sought to consign his nation to what Martin Luther called "the hell of celibacy". He took his own celibacy vow unilaterally, without consulting his wife.

Both Gandhi and his hagiographers claimed he viewed women as equal to men, pointing to his inclusion of women in India's independence struggle. He celebrated non-violent protest as a "feminine" principle, neutralising the masculine brutality of British rule. But his sexual hang-ups caused him to carry monstrously sexist views. His view of the female body was warped. As accounted by Rita Banerji, in her book Sex and Power, "he believed menstruation was a manifestation of the distortion of a woman's soul by her sexuality".

During Gandhi's time as a dissident in South Africa, he discovered a male youth had been harassing two of his female followers. Gandhi responded by personally cutting the girls' hair off, to ensure the "sinner's eye" was "sterilised". Gandhi boasted of the incident in his writings, pushing the message to all Indians that women should carry responsibility for sexual attacks upon them. Such a legacy still lingers. In the summer of 2009, colleges in north India reacted to a spate of sexual harassment cases by banning women from wearing jeans, as western-style dress was too "provocative" for the males on campus.

Gandhi believed Indian women who were raped lost their value as human beings. He argued that fathers could be justified in killing daughters who had been sexually assaulted for the sake of family and community honour. He moderated his views towards the end of his life. But the damage was done, and the legacy lingers in every present-day Indian press report of a rape victim who commits suicide out of "shame". Gandhi also waged a war against contraceptives, labelling Indian women who used them as whores.

Like all men who wage a doomed war with their own sexual desires, Gandhi's behaviour around females would eventually become very, very odd. He took to sleeping with naked young women, including his own great-niece, in order to "test" his commitment to celibacy. The habit caused shock and outrage among his supporters. God knows how his wife felt.

Gandhi cemented, for another generation, the attitude that women were simply creatures that could bring either pride or shame to the men who owned them. Again, the legacy lingers. India today, according to the World Economic Forum, finds itself towards the very bottom of the gender equality index. Indian social campaigners battle heroically against such patriarchy. They battle dowry deaths. They battle the honour killings of teenage lovers. They battle Aids. They battle female foeticide and the abandonment of new-born girls.

In the words of the Indian writer Khushwant Singh, "nine-tenths of the violence and unhappiness in this country derives from sexual repression". Gandhi isn't singularly to blame for India's deeply problematic attitudes to sex and female sexuality. But he fought, and succeeded, to ensure the country would never experience sexual freedom while his legend persevered. Gandhi's genius was to realise the great power of non-violent political revolution. But the violence of his thoughts towards women has contributed to countless honour killings and immeasurable suffering.

Remember, there's no such thing as a saint.