Following Jesus' word and the fifth commandment, shouldn’t our duty be against any war?
"You have heard that it was said, an eye for an eye, and a tooth for a tooth.' But I tell you, do not resist an evil person. If someone strikes you on the right cheek, turn to him the other also. And if someone wants to sue you and take your tunic, let him have your cloak as well. If someone forces you to go one mile, go with him two miles. Give to the one who asks you, and do not turn away from the one who wants to borrow from you." (Matthew 5:38-42, NIV)
Does it mean that after September 11 we did wrong to attack Afghanistan?
You make several mistakes in an attempt to get the Scriptures to say what you wish to believe.
First, you cite one of the Ten Commandments. I assume you are referring to "You shall not murder" (Exodus 20:13). The Roman Catholics number this differently from the rest of the world, they call this the fifth commandment and everyone else refers to it as the sixth. While murder remains wrong under the covenant of Christ (Romans 13:9), Christians recognize that the Old Covenant made with Moses has come to an end, being fulfilled in Christ when he died on the cross. "And you, being dead in your trespasses and the uncircumcision of your flesh, He has made alive together with Him, having forgiven you all trespasses, having wiped out the handwriting of requirements that was against us, which was contrary to us. And He has taken it out of the way, having nailed it to the cross" (Colossians 2:13-14). See "Why We Don't Follow the Old Testament" for more details.
But even if you wanted to cite this command, the Old Testament makes it clear that it doesn't apply to war. Moses and the Israelites lived under these commands and the Old Testament is filled with discussions of various battles. For example, "And Moses said to Joshua, "Choose us some men and go out, fight with Amalek. Tomorrow I will stand on the top of the hill with the rod of God in my hand." So Joshua did as Moses said to him, and fought with Amalek. And Moses, Aaron, and Hur went up to the top of the hill. And so it was, when Moses held up his hand, that Israel prevailed; and when he let down his hand, Amalek prevailed. But Moses' hands became heavy; so they took a stone and put it under him, and he sat on it. And Aaron and Hur supported his hands, one on one side, and the other on the other side; and his hands were steady until the going down of the sun. So Joshua defeated Amalek and his people with the edge of the sword" (Exodus 17:9-13). Since this battle and others were done at the command of God, it is clear that "You shall not murder" doesn't apply to war.
The passage you cite from Matthew 5:38-42 is a discussion by Jesus concerning the Jew's misapplication of the Old Law by their traditions. They had taken a law directing judges on how to apply punishment to a person found guilty of a violent crime and then applied it to their everyday dealings with other people. Jesus scolds them and then puts it back into its proper context. See "The Sermon on the Mount: Revenge" for more details. You are making a similar error. You are taking teachings about individuals not taking personal vengeance and attempting to apply it to governments.
Yet, God states that one of the duties of government is to take vengeance on evildoers: "Let every soul be subject to the governing authorities. For there is no authority except from God, and the authorities that exist are appointed by God. Therefore whoever resists the authority resists the ordinance of God, and those who resist will bring judgment on themselves. For rulers are not a terror to good works, but to evil. Do you want to be unafraid of the authority? Do what is good, and you will have praise from the same. For he is God's minister to you for good. But if you do evil, be afraid; for he does not bear the sword in vain; for he is God's minister, an avenger to execute wrath on him who practices evil" (Romans 13:1-4).
Thus, your mishandling of the Scriptures leads to a contradiction. You claim it was wrong for a government to do its God-given duty.