Former Massachusetts Gov. William F. Weld is launching a presidential exploratory committee to challenge President Trump in the Republican primaries, saying the country is “in grave peril” and he “cannot sit quietly on the sidelines any longer.”

Weld becomes the first Republican to officially announce he is exploring a run against Trump, and sets up a potential match-up in the first-in-the-nation New Hampshire presidential primary and in other states.

In prepared remarks at the “Politics & Eggs” breakfast in Bedford, N. H., Weld delivered a blistering critique of Trump, saying “we have a president whose priorities are skewed toward promotion of himself rather than toward the good of the country.”

“To compound matters, our President is simply too unstable to carry out the duties of the highest executive office — which include the specific duty to take care that the laws be faithfully executed — in a competent and professional matter,” Weld said in his prepared remarks. “He is simply in the wrong place.”

Weld, who lives in Sharon but has a home in New Hampshire, was the Libertarian Party vice presidential candidate in 2016 but just last month switched party affiliation, going back to the Republican Party.

In his speech, the former federal prosecutor called out his own party for supporting Trump, saying “many Republicans exhibit all the symptoms of Stockholm Syndrome, identifying with their captor.”

“The truth is that we have wasted an enormous amount of time by humoring this President, indulging him in his narcissism and his compulsive, irrational behaviors,” Weld said.

The former governor, who served in Massachusetts from 1990 to 1997, did not mention the “impeachment” word but hinted he would like to see Trump removed even before the 2020 election.

“The situation is not yet hopeless but we do need a mid-course correction,” he said. “We don’t need six more years of the antics we have seen. We need to make a change, and install leaders who know that character counts.”

The 73-year-old former governor was set to make his announcement this morning in at the breakfast sponsored by Saint Anselm College and the New England Council.

Weld’s announcement is likely to trigger anger among President Trump and his supporters, who see the former governor as a flip-flopper who deserted the Republican Party. The New Hampshire GOP chairman told the Herald he doesn’t expect Weld to get a welcome reception from voters there, and polls show a vast majority of GOP voters back Trump.

But sources close to Weld say he is determined to make life difficult for Trump, even if his candidacy is a long shot.

While Weld was harshest in his criticism of Trump, he also singled out Democrats for drifting too far left toward socialism.

“We need the opposite of socialism,” he said. “In the federal budget, the two most important tasks are to cut spending and to cut taxes — and spending comes first.”

Weld laid out his positions on other issues, calling for less government intervention in health care and for more intervention to prevent climate change.

“Republicans exhibit all the symptoms of Stockholm Syndrome, identifying with their captor.” — Bill Weld at #PoliticsAndEggs announcing his exploratory committee.#FITN #NHpolitics @nhgop pic.twitter.com/2xN2mLtoIv — NH Journal (@NewHampJournal) February 15, 2019