Wa'alaikum salaam if those foreign armies are directly or indirectly waging war against Muslims then it is absolutely forbidden. If they are not then I am not sure, check with a reliable shaikh.