Why did Cleopatra VII marry her brother?

She had to to be ruler of Egypt. The royal families always married together to keep the royalty in the family no matter what. The only thing was that they ended up killing off their siblings, parents, and children to keep the throne for them selves.