Image copyright Getty Images Image caption The pair have had a contentious relationship throughout the race 
 
 Defeated Republican presidential hopeful Ted Cruz has endorsed Donald Trump in the race for the White House. 
 
 The Texas senator fought Mr Trump in a bitter primary battle, marked by mud-slinging and personal insults. 
 
 Mr Cruz said he would fulfil his promise to vote for the Republican nominee and that electing Hillary Clinton would be "wholly unacceptable". 
 
 He drew ire at the Republican National Convention in July, when he was booed off stage for not endorsing Mr Trump. 
 
 "This election is unlike any other in our nation's history. Like many other voters, I have struggled to determine the right course of action in this general election," Mr Cruz announced in a Facebook post. 
 
 "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." 
 
 Everything Ted Cruz has said about Trump 
 
 The comments underscore a dramatic U-turn for Mr Cruz, who has referred to Mr Trump as a "trainwreck" and a "pathological liar" who could not be trusted in the White House. 
 
 Mr Trump responded to the Cruz reversal by saying he was "greatly honoured" to have the endorsement of "a tough and brilliant opponent". 
 
 But some of Cruz supporters decried the senator's announcement, including his former campaign spokesman, Rick Tyler, who told NBC: "It's mourning in America for conservatives. We lost our leader today." 
 
 Meanwhile, Trump campaign manager, Kellyanne Conway, who previously worked for a super PAC supporting Mr Cruz, expressed her relief on social media. 
 
 Image copyright Twitter 
 
 Analysis - Anthony Zurcher, BBC News, Washington 
 
 By endorsing Donald Trump now - after all the heat he took for his "vote your conscience" stand in July - Mr Cruz appears to be acknowledging two realities. 
 
 The first is that Mr Trump might actually win the presidency even without Mr Cruz's support. 
 
 At the very least, he will be competitive, diminishing the Texas senator's ability to tell his fellow party mates "I told you so". 
 
 The second is that Trump-ism is the future of the Republican Party - and if Mr Cruz wants to be a part of that, he's going to have to play ball. 
 
 The Texas senator has to run for re-election in 2018, and he faces the threat of a pro-Trump primary challenger. This endorsement could be a way to defuse that political bomb. 
 
 Although he styles himself as an ideological true believe, Mr Cruz has shown remarkable political flexibility. 
 
 The Ivy League establishment lawyer turned into anti-Washington firebrand to win a Senate seat. During the presidential campaign, he embraced Mr Trump when he saw it in his interest, then turned on the front-runner when the field narrowed. 
 
 Now, it seems, the Trump-Cruz bromance has been rekindled. But the Republican nominee would be wise to watch his back. 
 
 Mr Cruz said he decided to back his former foe due to six key policy differences between Mr Trump and Hillary Clinton, including the fate of the Supreme Court, Obamacare, immigration and energy. 
 
 Mr Trump and Mr Cruz repeatedly clashed during the primary campaign both on and off the debate stage. 
 
 Mr Trump came under fire after he tweeted an unflattering photo of Mr Cruz's wife, Heidi. 
 
 He also suggested that Mr Cruz's father, Rafael Cruz, was connected to the assassination of US President John F Kennedy. 
 
 Media caption The moment the crowd turned on Ted Cruz 
 
 Just before the Indiana primary election, Mr Cruz called the New York businessman a "braggadocios, arrogant buffoon" and a "serial philanderer". 
 
 At the Republican National Convention in Ohio, Mr Cruz refused to throw his support behind the official Republican nominee while giving a speech during a primetime slot. 
 
 He instead told Americans to "vote your conscience" in November and was subsequently booed off the stage. 
 
 After the event, Mr Cruz said: "I am not in the habit of supporting people who attack my wife and attack my father." 
 
 In announcing his decision on Friday, Mr Cruz emphasised that he was focused on preventing Mrs Clinton from winning the White House. 
 
 "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 news comes as Mr Trump prepares to face Mrs Clinton in the first presidential debate on Monday at Hofstra University in New York. ||||| Washington (CNN) Ted Cruz endorsed Donald Trump for the presidency Friday afternoon, a stunning turn of events after a contentious primary filled with nasty personal attacks and a dramatic snub at the Republican National Convention. 
 
 "After many 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 wrote in a Facebook post 
 
 "A year ago, I pledged to endorse the Republican nominee, and I am honoring that commitment. And if you don't want to see a Hillary Clinton presidency, I encourage you to vote for him." 
 
 "I am greatly honored by the endorsement of Senator Cruz," Trump said in a statement obtained by CNN. "We have fought the battle and he was a tough and brilliant opponent. I look forward to working with him for many years to come in order to make America great again." 
 
 The move -- three days before Trump's critical first debate with Clinton -- comes as the Trump and Cruz camps have moved closer in recent weeks. 
 
 Trump's vice presidential nominee Mike Pence played a key role in bringing Cruz into the fold. Pence and Cruz traded multiple messages, then spoke at length once on the phone and again in person, when Pence visited Capitol Hill a few weeks ago, a source close to Pence said. 
 
 Trump has hired key Cruz allies such as Kellyanne Conway as his campaign manager, and Jason Miller as a spokesman. 
 
 Wednesday, Trump's campaign expressed support for a Cruz-backed, Internet-related proposal in government funding talks in the Senate. 
 
 Friday, Trump released a new list of conservative judges likely to appeal to the former Supreme Court clerk -- including perhaps Cruz's closest friend in Congress, Utah Sen. Mike Lee. 
 
 Cruz cited Trump's pledges on the judiciary in his Facebook post. "We know, without a doubt, that every Clinton appointee would be a left-wing ideologue. Trump, in contrast, has promised to appoint justices 'in the mold of (the late Antonin) Scalia,' Cruz wrote. "For some time, I have been seeking greater specificity on this issue, and today the Trump campaign provided that, releasing a very strong list of potential Supreme Court nominees — including Sen. Mike Lee, who would make an extraordinary justice — and making an explicit commitment to nominate only from that list." 
 
 A Cruz endorsement could be the last pillar to helping Trump shore up the support of conservatives who have remained reticent about supporting his campaign. 
 
 Trump has already gotten most Republicans and conservatives on board with his campaign -- largely by reassuring them on the Supreme Court and on issues like the Second Amendment and abortion. But Cruz's principled opposition to offering his support has given some conservatives high-profile cover. 
 
 Just as Cruz's refusal to endorse Trump at the RNC fueled Democrats' efforts to paint Trump as divisive even within his own party, Cruz's endorsement will help undermine that narrative -- suggesting to conservatives unsure about Trump that perhaps the brash billionaire has changed, and can be trusted to bring conservative change to Washington. 
 
 'Lyin' Ted' and 'utterly amoral' 
 
 The move marks a dramatic turnaround from the personal insults Cruz and Trump traded during the previous year. 
 
 The two men clashed repeatedly during the primaries, as Trump taunted the senator with the nickname "Lyin' Ted," suggested Cruz wasn't eligible to be president due to his Canadian birthplace, and even speculated that Cruz's father was involved in the JFK assassination. Trump also said Cruz should "be careful" or he would " spill the beans on your wife ," and retweeted an unflattering picture of Heidi Cruz. Those tweets have not been deleted from Trump's account. 
 
 Lyin' Ted Cruz just used a picture of Melania from a G.Q. shoot in his ad. Be careful, Lyin' Ted, or I will spill the beans on your wife! — Donald J. Trump (@realDonaldTrump) March 23, 2016 
 
 On his last day of the GOP campaign -- the Indiana primary in early May -- Cruz let loose against Trump , calling the businessman a "serial philanderer," "utterly amoral," and "a narcissist at a level I don't think this country's ever seen. 
 
 At the RNC in Cleveland, Cruz gave a memorable speech espousing conservative values but ended without endorsing Trump, as Trump allies booed from the convention floor. "Don't stay home in November," Cruz said. "Stand and speak and vote your conscience." 
 
 The next day, he defended the move by citing Trump's attacks against his family. 
 
 "I'm not in the habit of supporting people who attack my wife and attack my father," Cruz told members of the Texas delegation . "That pledge was not a blanket commitment that if you go and slander and attack Heidi that I'm going to nonetheless come as a servile puppy dog and say, 'Thank you very much for maligning my wife and maligning my father.'" 
 
 After the convention, Trump said that he would not accept Cruz's endorsement if he offered it. 
 
 "I don't want his endorsement. If he gives it, I will not accept it, just so you understand. If he gives it I will -- I will not accept. It won't matter. Honestly he should've done it because nobody cares and he would've been in better shape for four years from now," Trump said. 
 
 Facing Senate primary in 2018? 
 
 Cruz's move may also be politically expedient. He faces a possible 2018 Senate primary challenge from Texas Rep. Michael McCaul, the chairman of the House Homeland Security Committee, who has increasingly made an issue of Cruz's failure to endorse Trump. 
 
 Republican National Committee Chairman Reince Priebus has said Republicans who don't back Trump could pay a price down the road. And Trump also floated the idea of setting up a super PAC to oppose Cruz if he decided to run for office again. 
 
 Clinton's campaign, after Cruz's message posted on Facebook, was happy to note a number of shots Cruz took at Trump during the primary, including when he called on the businessman to release his tax returns. 
 
 Clinton's official twitter account retweeted a tweet Cruz sent during the primary that said, "I've released 9 years of tax returns. RT if you agree it's time for Donald Trump to release his!" 
 
 I've released 9 years of tax returns. RT if you agree it's time for Donald Trump to release his! https://t.co/08whtFVC0r — Ted Cruz (@tedcruz) April 19, 2016 
 
 Clinton's campaign has been hounding Trump to release his taxes, arguing that he isn't doing so because they show shady business deals and ties to Russia. Trump has said he would release his taxes after an IRS audit. 
 
 Clinton's vice presidential nominee Tim Kaine, campaigning in Austin, Texas, Friday, said he couldn't support someone who used the same language Trump did about Cruz's father. 
 
 "I just can't help but say this," Kaine said. "Donald Trump suggested that Ted Cruz's dad was involved in the JFK assassination. Now we know that that is false, but false isn't, there's not the right word to describe what that is. It is so outrageously false. And as far as I know Donald Trump has not retracted it. As far as I know he has not apologized for it. And so if somebody said that about my dad they would never have me as a supporter for anything." 
 
 Radio host Steve Deace tweeted his disappointment, calling the move a mistake and speculating that Cruz backers may not all follow the senator. 
 
 "I think it's the worst political miscalculation of my lifetime. I hope I am wrong. The people will decide that," Deace tweeted.
– Ted Cruz believes an "utterly amoral" "serial philanderer" who's also an unprecedented "narcissist" and "arrogant buffoon" should be the next leader of the free world. That's right: Cruz has officially endorsed Donald Trump for president. In a Facebook post Friday, Cruz says he's decided to vote for Trump "after many months of careful consideration, of prayer, and searching my own conscience." He cites his own stance as "#NeverHillary" and Trump's positions on energy, immigration, national security, and more as reasons to vote for a man he once said some very negative things about. According to CNN, Cruz previously said he wouldn't endorse Trump after Trump implied Cruz's father may have been involved in the JFK assassination and insulted Cruz's wife's looks. While CNN calls it a "stunning" move, the BBC notes there are a few reasons Cruz may have changed his tune. One, Trump now appears to have a better shot at winning—or at least not embarrassing himself—lessening the chances Cruz can say "I told you so." It also now appears that "Trump-ism is the future of the Republican Party," and Cruz has to worry about facing a pro-Trump primary opponent in 2018. In a statement, Trump says he's "greatly honored by the endorsement." Trump had previously said he wouldn't accept an endorsement from "Lyin' Ted" Cruz.