NEW YORK — Former President Donald Trump seemed alternately irritated and exhausted Monday morning, as his lawyers and prosecutors hashed out pretrial motions before jury selection in his criminal case.

Even as a judge was hearing arguments on last-minute issues in a criminal case that centers on salacious allegations and threatens to upend his bid for the presidency, Trump appeared to nod off a few times, his mouth going slack and his head drooping onto his chest.

The former president’s lead lawyer, Todd Blanche, passed him notes for several minutes before Trump appeared to jolt awake and notice them.

Stories about Donald Trump

At other times, Trump whispered and exchanged notes with Blanche. He sat motionless while his own words from the infamous “Access Hollywood” tape — on which he bragged about grabbing women’s genitals — were read from a transcript by a prosecutor.

At times, Trump’s emotions were characteristically on display. He smirked and scoffed, and appeared frustrated when the judge in the case, Juan Merchan, did not immediately agree that he could miss court to attend the graduation of his youngest son, Barron.

But when Merchan warned that Trump could be ejected or thrown in jail if he disrupts the proceedings, the former president indicated that he understood.

The only time Trump showed a flash of humor was when he laughed at one of his own social media posts, which attacked his former fixer, Michael Cohen, who is expected to be the prosecution’s central witness.