Yes, you can have it both ways and a hundred ways beyond that simple analysis without committing American troops to the middle east. There are hundreds of actions which can further the goals of stopping terrorism which does not involve military invasions. The cost benefit analysis is not black or white, and it is hardly simple.
Now to the simplistic black and white, morality of either it is right or wrong. Hardly. Was it wrong for Ike to see 10k Americans die in a month in the invasion of Europe. Do you think he did not know the reality of what he was committing these kids lives. Was his decision a simple right or wrong answer or in reality a multi layered process of decision making which tried to maximize the benefits against the costs of winning that war. When President Obama through his chain of command of the military targets precisely enemies using drones and airstrikes, this most certainly is a military action whose cost and benefit may be debated, but even with horrible collateral damage it is but a fraction of the cost in lives and resources where invasion by American troops is the policy choice. Pragmatic solutions are the antithesis of modern Republican policies where government is seen as evil, and all policies must be impeded. Again the black and white analysis is simplistic and sophomoric.