Ted Cruz endorses Donald Trump

CORAL GABLES, FL - MARCH 10: Republican presidential candidates Donald Trump and Sen. Ted Cruz (R-TX) shakes hands on stage as they arrive for the CNN, Salem Media Group, The Washington Times Republican Presidential Primary Debate on the campus of the University of Miami on March 10, 2016 in Coral Gables, Florida. (Photo by Joe Raedle/Getty Images)

Credit: Joe Raedle

Credit: Joe Raedle

CORAL GABLES, FL - MARCH 10: Republican presidential candidates Donald Trump and Sen. Ted Cruz (R-TX) shakes hands on stage as they arrive for the CNN, Salem Media Group, The Washington Times Republican Presidential Primary Debate on the campus of the University of Miami on March 10, 2016 in Coral Gables, Florida. (Photo by Joe Raedle/Getty Images)

Ted Cruz says he's voting for Donald Trump for president - a shocking about-face after he rocked the Republican convention by dramatically refusing to do so.

The Texas senator says on Facebook that he made the decision for two reasons. First, his promise to support the Republican nominee. And second, his belief that Democrat Hillary Clinton is "wholly unacceptable."

The flip-flop was a stunner since the Texan was booed lustily during a floor speech at his party's convention for urging Republicans to "vote your conscience" without naming Trump.

Cruz finished second to Trump in a bitter primary and for months balked in offering support, despite his previous pledge to endorse the eventual Republican nominee.

Polls have since suggested that Cruz's popularity was slipping nationally and back home in Texas, where he could face a primary challenger for re-election in 2018.

The Associated Press contributed to this report