Makassar used his mask as a processing centre, which meant he could control the mind of any Unit, as well as anyone else who wore the masks. The shared mind increased their mental capacity.
At some point, knowing his body was failing, he invited representatives from other worlds to increase his command. When Makassar discovered the Ninth Doctor was a Time Lord, he made the Doctor and his companion, Rose, at home in his castle and asked the Doctor to attend the conference. In an attempt for Makassar to leave his body and take over the body of the Doctor as well, the Units placed the Doctor and Rose in the group mind.
The Doctor used his mind to free Rose from Makassar's hold and created a version of the Powell Estate out of his memories for them to hide in. When Rose called for a rogue Unit who had briefly tried asking for help earlier, the Doctor used this distraction as an opportunity to escape.
While the Units were distracted, the Doctor's projection flew through Makassar's castle and removed a mask from a Unit. Caught in a mental struggle with Makassar, the Doctor's projection succeeded in removing Makassar's mask and placed the other Unit's mask on his face. Makassar was caught in a loop where he could neither control minds nor obey orders and the Units and the representatives were freed. (PROSE: The Masks of Makassar)