Republican Texas Senator and former presidential hopeful Ted Cruz has finally endorsed GOP nominee Donald Trump for US president, ending a long-running feud with the New York businessman.

“After months of careful consideration, of prayer and searching my own conscience, I have decided that on Election Day, I will vote for the Republican nominee, Donald Trump,” Cruz said in a Facebook statement on Friday.

The senator, who drew ire at the Republican National Convention (RNC) in July for not endorsing Trump, said electing Democratic nominee Hillary Clinton would be “wholly unacceptable.”

“Our country is in crisis. Hillary Clinton is manifestly unfit to be president, and her policies would harm millions of Americans,” he said. “And Donald Trump is the only thing standing in her way.”

The surprising decision to support Trump marks a dramatic U-turn for Cruz, who had referred to the real estate mogul as a “trainwreck" and a "pathological liar" who was not fit to lead America.

Trump responded to the news by saying he was “greatly honored” to have the endorsement of “a tough and brilliant opponent.”

During the RNC, Cruz received a standing ovation as he took the stage but was booed offstage after he withheld the endorsement and instead advised Americans to “vote your conscience.”

In his Facebook post, however, Cruz tried to make his case by highlighting six key policy differences between Trump and Clinton, namely immigration and energy.

Clinton responded to Cruz’s move by retweeting one of his old tweets, where the senator had blasted Trump for refusing to release his tax record.

Cruz had also called the former reality TV star a “braggadocios, arrogant buffoon” and a “serial philanderer.”

Trump sparked a wave of controversy by posting an unflattering photo of Cruz’s wife. He also connected Cruz’s father, Rafael, to former US president John F. Kennedy’s assassination.

The endorsement gives a major boost to Trump’s campaign about 50 days from the November election.

Cruz’s endorsement was denounced by some of his supporters, with his former campaign spokesman, Rick Tyler, saying, “It's mourning in America for conservatives. We lost our leader today.”