Court orders South Africa’s leader to pay legal costs