The controversy casts a shadow on what had been a successful Olympics for female athletes.