The early history of Singapore refers to its pre-colonial era before 1819, when the British East India Company led by Stamford Raffles established a trading settlement on the island and set in motion the history of modern Singapore.

Prior to 1819, the island was known by several names; an early reference may be in the 2nd century work by Ptolemy which identified a coastal port at the southernmost tip of the Malayan peninsula, called Sabana. However, historians generally attribute a 3rd-century Chinese traveller's record describing an island at the same location called Pu Luo Chung, a transcription of Singapura's early Malay name Pulau Ujong, as the first recording of its existence.

Singapore was known in the 13th to 14th century as Temasek. It changed its name to Singapura perhaps towards the end of 14th century.

The island was alternately claimed by the Siamese and the Javanese in the 14th century. The last ruler of Singapura, Parameswara fled to Malacca after an attack by either the Javanese or Siamese, and established the state of Malacca. It was controlled by Sultanate of Malacca in the 15th century and the Sultanate of Johor from the 16th century.

Early period 

From primary historical texts dated before the 14th century, scholars have identified some 24 names that possibly referred to the island of Singapore. The first possible mention of early Singapore dates to 2nd century CE cartographic references in the Greco-Roman astronomer Ptolemy's Geographia. A place called Sabana or Sabara was marked on the 11th Map of Asia at the southern tip of the Golden Khersonese (meaning the Malay Peninsula) where Singapore may lie. It was identified as a nominon emporion or designated foreign trading port, as part of a chain of similar trading centres that linked Southeast Asia with India and the Mediterranean. Identification of Sabana or Sabara however varies, with various authors proposing it to be in Selangor or near Klang, or just south of Malacca, or south Johor, as well as Singapore island itself. No archaeological evidence from this period has yet been found in Singapore. 

A 3rd century Chinese written record described the island of Pu Luo Chung (蒲羅中), probably a transcription of the Malay Pulau Ujong, "island at the end" (of the Malay peninsula). It mentions briefly a hearsay account of cannibals with 5 or 6-inch tails living there.

Another possible reference to Singapore was found in Nanhai Jigui Neifa Zhuan (A Record of Buddhist Practices Sent Home from the Southern Sea), travel accounts of the Buddhist monk Yijing from the Tang dynasty. Yijing mentioned several islands located in today's Southeast Asia, and one of which called Mo-he-xin or Mo-ho-hsin (摩诃新) was argued by Brian E. Colless to be the ancient Singapore.

Singapore Stone
A large boulder measuring 3 metres in height and width, inscribed with writings, used to exist at the mouth of the Singapore River, but was later blown up when Fort Fullerton was expanded and the river mouth widened. Only a few fragments survive, and it became known as the Singapore Stone.  Various dates between 10th to 13th century have been proposed for the inscriptions that is as yet undeciphered, and the script is suggested to be related to that used in Sumatran in that period.

Temasek

Early Singapore was called "Temasek", possibly a word deriving from "tasik" (Malay for lake or sea) and taken to mean Sea-town in Malay. The Nagarakretagama, a Javanese epic poem written in 1365, listed a settlement on the island called Tumasik as a vassal of the Majapahit. The name is also mentioned in the Malay Annals thought to have been written in 1535. Temasek may have diplomatic relationship with Vietnam, which recorded it as Sach Ma Tich, as early as the 13th century. It is also recorded by the Chinese traveller Wang Dayuan who visited the island around 1330 and described a place called Dan Ma Xi (單馬錫, a transcription of the Malay Temasek). The name  Dan Ma Xi or Temasek is written in Chinese as 淡馬錫 in the Mao Kun map.

Long Ya Men and Ban Zu 

It was recorded in 1320 that the Mongol sent a mission to obtain elephants from Long Ya Men  (龍牙門, Dragon's Teeth Gate). The people of Longyamen then responded in 1325 with a tribute and trade mission to China. Long Ya Men is believed to be the entrance to Keppel Harbour.  In his work Daoyi Zhilüe, Wang Dayuan described Long Ya Men as the two hills of Temasek that looked like "Dragon's teeth" between which a strait runs, and wrote about the place:

Wang further mentioned that lakawood and tin was produced there and the natives traded with Chinese from Quanzhou, but Chinese junks on their way back from the Western Oceans (西洋) may be met by pirates there who attacked with two to three hundred perahus (boats). Wang described another settlement on a hill behind Long Ya Men called Ban Zu  (班卒, a transcription of the Malay name pancur meaning a "spring"). It is thought to be located on Fort Canning Hill, and a spring used to exist on the west side of the hill. In contrast to those of Long Ya Men who were prone to piracy, the inhabitants of Ban Zu were described as honest, and they wore "their hair short, with turban of gold-brocaded satin," and were dressed in red cloth. Wang also reported that the Siamese attacked Temasek a few years before he visited, but the fortified city survived the attack which lasted a month. Ruins of the settlement on the hill were still visible in the early 19th century and were described by the Resident John Crawfurd.  In 1928, pieces of gold ornaments dating to the mid-14th century was discovered at Fort Canning Hill.

Recent excavations in Fort Canning provide evidence that Singapore was a port of some importance in the 14th century and used for transactions between Malays and Chinese.
Various documents suggest that following the decline of Srivijaya power, Temasek was alternately claimed by the Majapahit and the Siamese Ayutthaya Kingdom.

Singapura

Sometime in its history, the name of Temasek was changed to Singapura. The Sejarah Melayu (Malay Annals) contains a tale of a prince of Palembang, Sri Tri Buana (also known as Sang Nila Utama), who landed on Temasek after surviving a storm in the 13th century. According to the tale, the prince saw a strange creature, which he was told was a lion; believing this to be an auspicious sign, he decided to found a settlement called Singapura, which means "Lion City" in Sanskrit. It is unlikely there ever were lions in Singapore, though tigers continued to roam the island until the early 20th century. However, the lion motif is common in Hindu mythology, which was dominant in the region during that period (one of the words for "throne" in the Malay language is "singgasana", meaning "lion's seat" in Sanskrit), and it has been speculated that the "Singapura" name, and the tale of the lion, were invented by court historians of the Malacca Sultanate to glorify Sang Nila Utama and his line of descent.

Different versions of its history are told in Portuguese sources, suggesting that Temasek was a Siamese vassal whose ruler was killed by Parameswara from Palembang. Historians believe that during the late 14th century, Parameswara, the last Sumatran prince, fled to Temasek from Palembang after being deposed by the Majapahit Empire. According to Portuguese accounts, Parameswara killed the local chief with the title Sang Aji eight days after being welcomed into Temasek.

Not withstanding the Sejarah Melayu legend, the "Singapura" name possibly dates to this period.  Some argued that Singapura was named after the "lion throne" Parameswara established in Palembang as a challenge to the Majapahit empire, and for which he was expelled from Palembang. Parameswara held the island of Singapore for a number of years, until further attacks from either the Majapahit or the Ayutthaya kingdom in Siam forced him to move on to Melaka where he founded the Sultanate of Malacca. While there are parallels between the mythical Sang Nila Utama and the historical Parameswara, these should be seen as distinct.

Singapore as part of sultanate of Malacca
Archaeological evidence suggests that the main settlement on Fort Canning was abandoned around this time, although a small trading settlement continued in Singapore for some time afterwards. Singapore became part of the Malacca empire, and it was said to be the fiefdom of the legendary laksamana (or admiral) Hang Tuah. However, by the time the Portuguese arrived in the early 16th century, the Singapura that existed before Malacca was founded had already become "great ruins" according to the conqueror of Malacca Afonso de Albuquerque.

Part of Johor Sultanate
After the Portuguese captured Malacca in 1511, its laksamana fled to Singapore. In the 16th and early 17th century, it briefly regained some significance as a trading centre of Johor Sultanate whose Sultan kept a shahbandar (harbour master) at Kallang. In 1603, the Johor Malays formed an alliance with the Dutch and captured a Portuguese ship off the east coast of Singapore. The Portuguese then destroyed the outpost in Singapore in 1613. In the early 1620s, it was suggested that forts be built in the Singapore Straits to counter the rising power of the Dutch. Visitors to the area in the 17th century mentioned that it was inhabited by the Seletes who lived on water under the rule of Johor, but Singapore had largely sank into obscurity apart from a mention that  Singapore River was the location of a naval battle between Johor and Siak in 1767.

Beginning of colonial rule 
In 1819, Englishman Sir Stamford Raffles established a British trading post on the island, and modern Singapore was founded.

References

History of Singapore