Lai-Ma was a Cylox.
He and his Tko-Ma, were imprisoned in the 15th century in an other dimensional prison for misuse of their powers, including manipulating and destroying entire galaxies. However, each was able to establish a connection with an Earth psychic, and spent centuries trying to free themselves.
Lai-Ma's link was his Ini-Ma, who manifested in various women throughout history. After Tko-Ma contacted Sebastian Malvern and set up the Magnate to find him, Lai-Ma created time shadows to evade him.
Supposedly Tko-Ma wanted to return both of them to their prison. However, each were really trying to obtain the power of the other, to completely break free and resume the activities for which they had been imprisoned.
Malvern suspected this, and had the Magnate's ESPnets drain the energy from Tko-Ma's dimension. The Sixth Doctor convinced him to entrap himself in a fragment of the dimension to save himself. The Doctor then gave the fragment to Lai-Ma's Ini-Ma so she could trap the brother as well.
What the Doctor did not realise was that the Ini-Ma was really the jailer of the two Cylox. Rather than risk them trying to escape again, she unleashed energy to destroy herself and them. (PROSE: Instruments of Darkness)