The
Minangkabau people were the first migrant community to settle in the area north of the
Malacca Sultanate which eventually formed the
confederation of
Negeri Sembilan circa the 15th century. After the
Portuguese invaded Malacca in 1511, it then became a
protectorate of its successor, the
Sultanate of Johor. The population began to control local politics. By 1760, Johor, which was having trouble from the Dutch, allowed the state to appoint a ruler from
Pagaruyung in
Sumatra. Between 1760 and 1770, a council of leaders known as the
datuk-datuk penghulu luak (the predecessor of the modern
datuk-datuk undang) embarked in a negotiation expedition to Pagaruyung in the
Minangkabau Highlands, in search of a leader. The Yamtuan of Pagaruyung, Sultan Abdul Jalil Johan Berdaulat, obliged and gave them a leader in the form of his son, Raja Mahmud. Before Raja Mahmud left for the
Malay Peninsula, a member of royalty named Raja Khatib was sent to Negeri Sembilan to oversee Raja Mahmud's installation preparations. However, upon his arrival to Negeri Sembilan, Raja Khatib deceived the locals and claimed to be the prince sent from Pagaruyung. The locals believed him, and Raja Khatib was deemed the new king. Raja Mahmud, first sailed to Johor to ask for the
Sultan of Johor's consent to rule over Negeri Sembilan. The Sultan of Johor,
Mahmud Shah III, did not object and conferred upon Raja Mahmud the authority to reign over Negeri Sembilan. Raja Mahmud's expedition marched to Negeri Sembilan through
Naning. in
Naning, while en route to
Rembau. At Naning, Raja Mahmud's forces met Bugis warchief
Daeng Kemboja. War ensued, which ended with the Bugis forces defeated. Upon his arrival to Negeri Sembilan in 1773, Raja Mahmud was deemed king and invested as
Yamtuan Besar in Kampung Penajis in
Rembau, as Raja Melewar. Raja Melewar learned of Raja Khatib's scheme and to become the undisputed ruler of the state, declared war against Raja Khatib. Raja Melewar later relocated his palace to
Seri Menanti, which remains the royal capital of Negeri Sembilan. ==Death and legacy==