The Sanjaya–
Shailendra relationship has been uncertain.
Poerbatjaraka theorized that there was no distinct Sanjaya dynasty and one dynasty, Shailendra, ruled central Java. The kingdom was called Mataram (Javanese: ), with its capital in the Mataram area. Sanjaya and his offspring belonged to the Shailendra family, who were initially
Shaivist. Another theory suggests that the Sanjaya dynasty was forced into northern Java by the Shailendra dynasty, which emerged around 778. Evidence for this event is based on the
Kalasan inscription. The Sanjaya and Shailendra dynasties co-existed during this period in central Java, which was characterized by peace and cooperation. The association of Shailendra with
Mahayana Buddhism began after the conversion of Raja Sankhara (Rakai Panaraban or Panangkaran) to Buddhism. Later Shailendran kings, successors of Panangkaran, also became followers of Mahayana Buddhism and gave it royal patronage in Java until the end of Samaratungga's reign. This theory is based on the
Raja Sankhara inscription (now missing), the
Sojomerto inscription, and the
Carita Parahyangan manuscript. Shaivism regained royal patronage again from the reign of
Pikatan to the end of the Mataram Kingdom. The Shailendra family used the
Old Malay language in some of their inscriptions, which suggests the dynasty's origin in
Sumatra and their connections with
Srivijaya. This theory posits that the Shailendras, with their strong connections to Srivijaya, gained control of central Java and ruled the
rakais (local Javanese lords); this included the Sanjaya, incorporating the dynasty's kings into their bureaucracy. The dynastic court was apparently in the southern
Kedu Plain, near
Magelang (north of
Yogyakarta). ==Relations with Champa==