Based on the historical records, the first civilization in Nepal was found around the 6th century B.C. It was limited to the Kathmandu Valley. It became the capital city later. The first rulers were regarded as the Gopals, who came from India with cow. Then the Mahispals, who also came from India with buffalos. The documented history begins with the Changu Narayan temple, inscription of King Mandev I (C 464-505 A.D.) of the Lichhavi dynasty.
The Lichhavis are said to have migrated into Nepal from north India in around 250 A.D. They spanned their kingdom over a period about 630 years. The early Malla rule was started in the 12th century and over the next two centuries grew into a large empire before disintegrating into small principalities.
The nation known as Nepal was scattered into several small states ruled by many kings. Later, Prithvi Narayan Shah unified it as a single nation in 1768. Under his successors, the borders of Nepal expanded to the far near Kashmir in the west and Sikkim in the east, but they are now in India. A commercial treaty was signed with East India Company, a colonial agent of Britain in 1792 and again in 1816 after more than a year of fighting with them.