WASHINGTON—Some Democratic state attorneys general say they may go to court to block any declaration of a national emergency on the southern border by President Trump.

Attorney General Xavier Becerra of California wrote Thursday on Twitter that any border crisis is of the president's own making and "we will do what we must to hold him accountable."

His counterpart in Washington state, Bob Ferguson, said that if Mr. Trump's declaration depletes federal aid to the state, he'll "take appropriate steps to block this unlawful action."

On Twitter, Puerto Rico Gov. Ricardo Rossello told the president "we'll see you in court" if he goes through with the declaration.

Get Breaking News Delivered to Your Inbox

Mr. Trump is prepared to invoke a national emergency to build the U.S.-Mexico wall after Congress refused to provide $5.7 billion he was demanding as part of a budget compromise to avoid a federal shutdown.