The area was a part of the Majapahit Empire during its zenith around the 14th century. The city itself was founded sometime in the late fifteenth century, possibly by a Chinese whose descendant later became the Sultans of Demak.