WASHINGTON — A coalition of 16 states, including California and New York, on Monday challenged President Trump in court over his plan to use emergency powers to spend billions of dollars on his border wall.

The lawsuit is part of a constitutional confrontation that Mr. Trump set off on Friday when he declared that he would spend billions of dollars more on border barriers than Congress had granted him. The clash raises questions over congressional control of spending, the scope of emergency powers granted to the president, and how far the courts are willing to go to settle such a dispute.

The suit, filed in Federal District Court in San Francisco, argues that the president does not have the power to divert funds for constructing a wall along the Mexican border because it is Congress that controls spending.

[Read the full lawsuit here.]

Xavier Becerra, the attorney general of California, said in an interview that the president himself had undercut his argument that there was an emergency on the border.