ALBANY — For two consecutive days, President Trump turned his Twitter fury against two of the highest elected officials in his home state: Gov. Andrew M. Cuomo and the attorney general, Letitia James, both Democrats.

It was not immediately clear what prompted Mr. Trump to lash out; his tweets on Monday focused on his treatment by Ms. James’s office. Without mentioning Ms. James by name, the president said she was “harassing all of my New York businesses in search of anything at all they can find to make me look as bad as possible.”

Mr. Trump continued his tirade on Tuesday, suggesting that New York’s tax rate was driving away residents “like never before.”

The outburst prompted a return of fire from Mr. Cuomo on Tuesday, who issued a statement entitled, “President Trump’s Day 2 Twitter Tantrum,” saying Mr. Trump was in “la la land.”