As US President Donald Trump starts his first official visit to Saudi Arabia on Saturday, he is being carefully watched in light of comments he has made, both during his election campaign and after gaining the presidency, that have been seen by many as hostile both to Islam and Muslims.

During his campaign, he famously pledged to close US borders to all Muslims out of security concerns.

"Donald J. Trump is calling for a total and complete shutdown of Muslims entering the United States until our country's representatives can figure out what the hell is going on," he told a rally in the state of South Carolina in December last year.

Read: Trump's anti-Muslim comments spark global backlash

Muslim bans?

As president, he then introduced two travel bans for several predominantly Muslim countries for "security reasons," though he and his administration insist that these were not "Muslim bans."

Watch video 01:02 Merkel's statement on Trump's travel ban

The bans, which were blocked by US courts, did not include Saudi Arabia - one of the main US allies in the Middle East - among the blacklisted countries, although 15 of the 19 men involved in the September 11, 2001, attacks were Saudi citizens.

Critics of the proposed bans have pointed out that no significant terrorist attacks have been carried out on US soil by nationals from the six countries that are listed: Somalia, Iran, Syria, Sudan, Libya and Yemen.

The second attempt to put a ban in place removed Iraq from an original list of seven countries whose nationals would not have been allowed to enter the United States.

Contradictory statements

However, his comments on Islam and Muslims have often contradicted each other.

On the negative side, he told the US broadcaster CNN, "Islam hates us." When asked whether he meant all of the religion's 1.6 billion adherents, Trump answered: "I mean a lot of them."

He has also frequently claimed that Muslims represented a security threat: "I didn't see Swedish people knocking down the World Trade Center" is just one example in which he compared Swedes favorably with Muslims.

And he drew vehement criticism even from within his own party for comments in which he seemed to suggest that the mother of a Muslim American soldier killed by a suicide bomber in Iraq had been forbidden by religious considerations from speaking at the Democratic National Convention.

Read: Trump under fire from Republicans over Khan comments

Conciliatory tones

On other occasions, however, he has said, "I love the Muslims. Great people," and referred to the "phenomenal" people from the Muslim community he has worked with.

Trump has also used inflammatory rhetoric with regard to Mexicans, women and many others

On his Saudi trip, Trump has said he will ask Muslim leaders "to fight hatred and extremism and embrace a peaceful future for their faith."

The president is seen as being likely to find favor in Sunni Saudi Arabia for his tough stance on Shiite Iran. His predecessor, Barack Obama, had aroused suspicion in Gulf Arab states for what was seen by them as a lenient attitude to their regional rival.

Read: Trump in Saudi Arabia - counterterrorism and weapons deals