Twitter Inc. shut down the account of a prominent Iraqi militia leader after he was accused by the U.S. government of inciting violence against American diplomats in Basra, where the U.S. consulate came under a rocket attack.

The episode illustrates the importance that social media has come to play in mobilizing political support in Iraq—and, potentially, in encouraging militia attacks. It comes as Iraqi politicians are struggling to form a new government and the U.S. and Iran are vying for influence.

A...