President Trump took a second swing at his temporary travel ban Monday, this time targeting travelers from six majority Muslim countries and crafting his executive order in ways intended to survive challenges in U.S. courts.

The new ban, which goes into effect March 16, no longer restricts travel from Iraq, one of seven listed in the original order. The 90-day ban now is limited to Iran, Libya, Somalia, Syria, Sudan and Yemen.

As before, the order shuts down the U.S. refugee program for 120 days to give the federal government time to develop "extreme vetting" procedures to prevent terrorists from entering the country. However, Syrians are no longer subject to an indefinite ban, as they were under the first order.

The White House spent weeks drafting the revised ban, coordinating with the departments of State, Justice and Homeland Security to avoid the chaos that followed the Jan. 27 order. That one took immediate effect, snarling travel for thousands of people around the world and at U.S. airports. This time, the order takes effect 10 days after Trump signs it at the White House.

"The U.S. Government must ensure that those entering this country will not harm the American people after entering, and that they do not bear malicious intent toward the United States and its people," Homeland Security said in a statement. "This Executive Order ensures that we have a functional immigration system that safeguards our national security."

While the goal of the executive order remains the same — keeping terrorists out — the administration made several other big changes to avoid being struck down in court.

Nationals of the six countries with legal permanent residence in the U.S. (known as green card holders) are not affected. People with valid visas as of Monday also are exempt. And the order no longer gives immigration preference to "religious minorities," such as Christians who claim they are persecuted in mostly Muslim countries.

Iraq was dropped from the ban after negotiations with the Iraqi government, which vowed to improve the security of its travel documents, share more information on its citizens with the U.S. government and agreed to accept Iraqi nationals who have been ordered deported from the U.S., according to a senior Homeland Security official, who spoke on condition of anonymity to fully discuss the new order ahead of the president's signing.

A federal judge in Seattle issued a nationwide hold on the order after lawyers for travelers detained at U.S. airports filed lawsuits. His ruling was upheld by the 9th U.S. Circuit Court of Appeals.