Question concerning upstream backup servers

How does nginx handle backup servers? For example…

upstream squids {
server; # squid 1
server; # squid 2
server backup; # nginx
server backup; # perlbal

if both squids fail, How will nginx balance? Will it round-robin both
backups? or will it try the first backup and then move to the next one
if the first backup failed?

Quite interested in this.