Winston Churchill favoured letting Gandhi die if he went on hunger strike, newly published Cabinet papers show.
Gandhi was eventually assassinated by Hindu extremists in 1948
The UK's WWII prime minister thought India's leader should be treated like anyone else if he stopped eating while being held by the British.
But his ministers persuaded him against the tactic, fearing Gandhi would become a martyr if he died in British hands.
Gandhi was detained in 1942 after he condemned India's involvement in the war but never went on hunger strike.
Many British officials initially took a hardline stance to the possibility of such action.
The Viceroy of then British-run India, Lord Linlithgow, said he was "strongly in favour of letting Gandhi starve to death".
But senior government figures, such as former foreign secretary Lord Halifax argued: "Whatever the disadvantages of letting him out, his detention would be much worse."
Eventually in January 1943, ministers decided that although they could not give into a hunger strike publicly - they would be willing to release the spiritual leader on compassionate grounds.
"He is such a semi-religious figure that his death in our hands would be a great blow and embarrassment to us," said Sir Stafford Cripps, then Minister for Aircraft Production.
But Churchill had said he would prefer to keep Gandhi locked up and let him do "as he likes".
However, he added: "But if you are going to let him out because he strikes, then let him out now."
Gandhi was eventually released in 1944 because of fears his failing health meant he could die in British custody.
He was assassinated on 30 January, 1948, aged 78, after Indian independence.
The full papers are on display at the National Archives in Kew, south-west London.