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.

Sen. 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.

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.

Trump says that he's "greatly honored" by what he describes as the senator's endorsement.

Trump said in a statement that he and Cruz "have fought the battle" and called Cruz a "tough and brilliant opponent."

Recent polls had 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.