GAYOOM was defeated in a runoff poll by Mohamed NASHEED , a political activist who had been jailed several years earlier by the former regime .