But Prime Minister Theresa May was forced to rule out the prospect of military action to defend the British enclave of Gibraltar on Monday, after a former leader of her Conservative Party seemed to suggest that might be necessary to keep Spain from demanding the territory’s return as part of the deal to allow the United Kingdom to trade freely with remaining E.U.