William F. Weld, the maverick former governor of Massachusetts, announced on Friday that he would form an exploratory committee to challenge President Trump for the Republican Party’s 2020 nomination, presenting himself as a dissident voice in a political party that has abandoned its mainstream roots.

[Make sense of the people, issues and ideas shaping American politics with our newsletter.]

Mr. Weld, 73, is the first Republican to announce he will run against the president. But Mr. Weld is unlikely to pose a major threat to Mr. Trump and he is in some ways an incongruous figure to leap into the presidential fray. Mr. Weld is a moderate Republican who ran for vice president in 2016 on the Libertarian ticket. His candidacy might be more of an act of protest than a conventional national campaign.

But appearing in New Hampshire, Mr. Weld called it a moral duty to stand against “the hard heart, closed mind and clenched fist of nativism and nationalism.”

[Check out the Democratic field with our candidate tracker.]

“I hope to see the Republican Party assume once again the mantle of being the party of Lincoln,” Mr. Weld said, according to video posted by the news station WCVB. “It upsets me that our energies as a society are being sapped by the president’s culture of divisiveness of Washington.”