GAZA CITY — When war between Israel and Hamas broke out two weeks ago, the Palestinian militant group was so hamstrung, politically, economically and diplomatically, that its leaders appeared to feel they had nothing to lose.

Hamas took what some here call “option zero,” gambling that it could shift the balance with its trump cards: its arms and militants.

Now, this conflict has demonstrated that while Hamas governed over 1.7 million people mired in poverty, its leaders were pouring resources into its military and expanding its ability to fight Israel. If it can turn that improved military prowess into concessions, like opening the border with Egypt, that may boost its standing among the people of Gaza — although at an extraordinarily high cost in deaths and destruction.