The US attacked Iran after learning Israel planned a strike and fearing retaliation. Iran had ordered automatic retaliation against US forces if attacked, per Rubio. President Trump decided to preemptively strike alongside Israel to reduce US casualties.