WASHINGTON — An American warship stationed off the coast of Yemen fired cruise missiles on Thursday at radar installations that the Pentagon said had been used by Yemeni insurgents to target another American warship in two missile attacks in the last four days.

The strikes against the Houthi rebels marked the first time the United States has become involved militarily in the civil war between the Houthis, an indigenous Shiite group with loose connections to Iran, and the Yememi government, which is backed by Saudi Arabia and other Sunni nations. The strikes were approved by President Obama, said Peter Cook, the Pentagon spokesman, who warned of more to come if American ships were fired upon again.

“These limited self-defense strikes were conducted to protect our personnel, our ships and our freedom of navigation in this important maritime passageway,” the Pentagon said in a statement. “The United States will respond to any further threat to our ships and commercial traffic.”

Until Thursday, the Obama administration had tried to navigate a treacherous course in Yemen, publicly pushing for a peace deal while quietly providing military support to a Saudi Arabia-led bombing campaign against the rebels since last year. Yet the main goal of the administration has often appeared to be keeping the United States from being dragged too deeply into a conflict that has shown little signs of abating, and instead continues to grow deadlier.