When was Hajj made obligatory?

Hajj is one of the five pillars of Islam. The Prophet (peace and blessings be upon him) said, “Islam is built upon five pillars: testifying that there is no true god except Allah and that Muhammad is the Messenger of Allah, performing Prayer, paying the Zakah, making the pilgrimage to the Sacred House (Hajj), and fasting the month of Ramadan.” (Reported by Al-Bukhari).
Sheikh Abdul-`Aziz Ibn Baz, the late Mufti of Saudi Arabia, states the following: The matter is controversial among scholars. Some scholars are of the view that Hajj was made obligatory in the fifth year after Hijra; some state that it was ordained in the sixth year; others say that it was prescribed in the ninth year; some other scholars are of the opinion that it was made obligatory in the tenth year. The two last views are believed to be the most correct.