You forgot to add the coda: the British eventually failed in their attempt to impose the government of their choice in India, and the country was violently partitioned along religious lines.
Probably there is some level of US effort in Iraq that could lock down the country and tamp down resistance to perhaps the level of the IRA campaign against the British - at least for a time - but clearly this level of commitment is far beyond that which is supported by a large majority of US voters.
And absent that commitment and support, anything short of a similar occupation of Iran (a much bigger project than even the occupation of Iraq) which angers the Iranians is likely only to increase their level of support for the Shia insurgency.