I would say the former was the ultimate cause. The UK launched economic sanctions against Iran for nationalizing the oil industry. This caused problems in Iran and Mossadegh became increasingly dependent on the Tudeh, which turned the US against him.