the muslims wanted to opt out,they were led by mohamed ali jinnah and the british trying to avoid bloody civil war advised the all india delegation to come up with a plan. and the indian congress accepted the muslim demands.
Ghandi and rest of india were againest partition but they saw they had no option or else a destructive civil war.