The deal could give the Gulf state the impression that it can defy its neighbors and remain a frenemy of the U.S.