Jets were flown in Trump's honor. Men carrying American and Saudi Arabian flags rode on horses as they accompanied the presidential limousine. A military band played as Trump and his wife, Melania, got out of the car and walked on the red carpet to greet the Saudi king.

But Trump has not always been a fan of the conservative Muslim nation.

Before he was leader of the free world, Trump spent years publicly bashing Saudi Arabia. He repeatedly demanded that the Saudis compensate the United States for its long-standing alliance. During the presidential election, he condemned the country for its history of human rights violations. (As president, he has praised authoritarian leaders and has signaled that addressing abuses in other countries will not be at the forefront of his administration.)

“They must pay dearly! NO FREEBIES,” he tweeted in March 2015, saying Saudi Arabia should use its vast wealth to pay the United States accordingly for its “help and protection.”

Last year, Trump slammed the Clinton Foundation for accepting millions of dollars from a country that abuses women and is intolerant of members of the lesbian, gay, bisexual and transgender community.

“You talk about women and women's rights. These are people that push gays off business — off buildings. These are people that kill women and treat women horribly, and yet you take their money,” Trump said during a presidential debate last October in Las Vegas. “So I'd like to ask you right now. Why don't you give back the money that you've taken from certain countries that treat certain groups of people so horribly? Why don't you give back the money. I think it would be a great gesture …”

Crooked Hillary says we must call on Saudi Arabia and other countries to stop funding hate. I am calling on her to immediately return the $25 million plus she got from them for the Clinton Foundation!

According to the foundation's donor list, it received between $10 million and $25 million from Saudi Arabia. A spokesman for the foundation has said that the money was not given while Clinton was secretary of state.

Now, Trump has switched from being a loud critic of Saudi Arabia to a friendly ally.

Although he campaigned against Muslims during the election — proclaiming that “Islam hates us” — he comes to Saudi Arabia with a speech preaching religious tolerance.

The Saudi leader also gave the president the highest of honor for a foreign dignitary, the collar of Abdulaziz al-Saud, named for the kingdom’s founder, which Salman hung on a thick gold chain around Trump’s neck.

One of the highlights of Trump's visit is a multibillion-dollar deal to modernize Saudi Arabia's military and cyber defense systems, as well as its airborne intelligence capabilities. The two leaders signed a letter of intent to “support Saudi Arabia's defense needs” and agreements for almost $110 billion in military purchases from the United States. These include naval ships, tanks and other military vehicles that were subject to agreements under previous administrations.

The relationship between the United States and Saudi Arabia was strained under Obama, whom the kingdom criticized for being too soft on Iran and for failing to push for the ouster of Syrian President Bashar al-Assad.Still, Obama also faced pressure from human rights groups over Saudi Arabia's history with abuses and repression.