"Far from acting as a talisman for personal ends or a pretentiously "holy" way of sanctifying our selfish desires, prayer works only when human aspirations are sublimated to higher purposes. In short, availing prayer always operates within the ambiance of submission to God's holy will and is tacitly prefaced by the phrase "if it is your will (...). Hence to those who were querulously asking why their prayers were in vain (v3) James can truthfully reply that they have asked in the wrong spirit because their motives were alien to God's desire for peace and justice in his way. Prayer is removed from being treated as a magic incarnation (...) or a patriotic slogan - a warning unheeded by "Christian" armies who launched crusades to exterminate infidels; who sang of wider and wider boundaries of their imperial domain; or who went into battle with "God with us" on their soldiers' belts."
Ralph P Martin, Word Biblical Commentary, James, Waco, Texas, 1988, p. 156
No additional comment needed.