In the 500s and 600s C.E., the three kingdoms fought for control of the peninsula, until the Tang Dynasty sided with the silla kingdom.