The last prison

i was wondering if anyone saw the movie the last prison…after watching the movie i am rather confused what happened in the ending…anyon here want to explain to me what happened??

cuz the snitch says the sign of victory would be to raise the flag upside down… but why in the end does the leader of the prison raise the flag the right way…? anyone wanto explain to me??