A South African education scheme under fire for offering girls university scholarships on condition they remain virgins has been defended by the local mayor.