Legal challenges and pushback from Republican lawmakers prompt U-turn from the US president