That is where voters' second preferences came into play.
The least popular flag, the koru, was eliminated from the vote.
People who voted for the koru then had their votes redistributed. Their second preference votes were added to the tallies of the other flags.
Once this process had taken place, the red and blue silver fern flag still had a 20,000-vote lead - but had not reached the 50 per cent threshold. It had risen only slightly to 42.2 per cent.That meant another elimination.
The black and white silver fern flag, which had the lowest votes out of the remaining flags, was eliminated.
After that flag's supporters had their second preferences redistributed, the black and blue flag surged into the lead by 6000 votes, but without a clear majority. Both remaining silver fern flags were locked on just over 44 per cent.
It was not until Red Peak was eliminated, and its votes added to the two remaining flags' tallies, that a majority was won.
The black and blue silver fern flag emerged with 670,790 votes - 50.58 per cent of the total vote.
That is how the second most popular alternative flag in New Zealand was the first across the line.
For full details of the vote breakdown, see here: http://www.electionresults.govt.nz/2015-flag-referendum1/results-by-count-report.html