MOBILE, Ala. — Donald Trump and Jeff Sessions, the Queens-born developer and the Alabama lawyer, are finding that similar positions on political issues can mask deep differences on underlying principles.

For Mr. Trump, who has excoriated his attorney general on Twitter and reportedly discussed firing him, what matters most is personal loyalty to him, or rather loyalty to whatever he thinks his needs are at any particular moment. For Mr. Sessions, fealty to the law trumps all. For Republicans nationwide, it’s an acid test: side with a mercurial president who demands devotion, or with the attorney general, who insists on probity and the letter of the law.

If there’s one thing you need to know about Mr. Sessions, it’s that he reveres the Constitution, as he understands it. He was the author, in his first Senate term, of a law that established a commission to commemorate the 250th birthday of the “father of the Constitution,” James Madison, in 2001, and to use it as an occasion for constitutional and civic education. Mr. Sessions introduced Chief Justice William H. Rehnquist at the birthday gala, and personally convened a symposium of Madisonian scholars that met in conjunction with it.