The monastery was founded in 88 BC by King Valagamba (Vattagamani Abhaya) of Anuradhapura, in fulfillment of a vow that he had made to regain his throne when his country was invaded by the Tamils. Abhayagiri is the earliest heterodox Buddhist monastery in Sri Lanka; its doctrines included various Mahayana and esoteric concepts that were regarded as non-orthodox by its Theravada rivals.