On the basis of the EU directive on the status of refugees, a deserter can get asylum if he can substantiate his claim that his military unit will commit war crimes and that desertion was the only way for him not to have to take part in these crimes. When there's a UN mandate, or when a state that prosecutes war crimes is carrying out a military mission, it is in principle unlikely that war crimes would be committed. This is what the European Court of Justice has answered to a German judge in the case Shepherd v. Germany.