A Friend of the World Becomes an Enemy of God

Many months I was teaching a bible class at church as a part of a series on the book of James. I was working through Chapter 4 which contains a string of rapid-fire imperatives:
James 4.7-10
Submit yourselves, then, to God. Resist the devil, and he will flee from you. Come near to God and he will come near to you. Wash your hands, you sinners, and purify your hearts, you double-minded. Grieve, mourn and wail. Change your laughter to mourning and your joy to gloom. Humble yourselves before the Lord, and he will lift you up.
Submit. Resist. Come near. Wash. Purify. Grieve. Humble yourselves.
When we read texts like this our tendency is to interpret them pietistically and individualistically. Our struggle to resist the devil, for example, is a struggle to purify our hearts in a private, spiritual battle against lust or anger or addiction.
This interpretation is reinforced by the text that comes directly before the command to "resist the devil":
James 4.4-6
You adulterous people, don’t you know that friendship with the world means enmity against God? Therefore, anyone who chooses to be a friend of the world becomes an enemy of God. Or do you think Scripture says without reason that he jealously longs for the spirit he has caused to dwell in us? But he gives us more grace. That is why Scripture says: “God opposes the proud but shows favor to the humble.”
Again, the temptation here is to interpret "friendship with the world" pietistically. The world is a place where people are sinful and we aren't to be friends with sinful people.
All in all, then, James 4.4-10 has tended to be a text read about Christian withdrawal from the world in an effort to maintain our moral purity.
But the context of James 4.4-10 is not about a private pietistic struggle. The context is about communal peace-making within the church.
The backdrop of the imperatives in James 4.4-10 starts back up in James 3.18. Here's the full context leading up to "do not be a friend of the world" and "resist the devil":
James 3.18-James 4.3
Peacemakers who sow in peace reap a harvest of righteousness.
What causes fights and quarrels among you? Don’t they come from your desires that battle within you? You desire but do not have, so you kill. You covet but you cannot get what you want, so you quarrel and fight. You do not have because you do not ask God. When you ask, you do not receive, because you ask with wrong motives, that you may spend what you get on your pleasures.
"Friendship with God" is being a peacemaker. And "friendship with the world" is associated with violence. "What causes fights and quarrels among you?" "You desire but do not have, so you kill."
In this text "the world" isn't a place full of moral depravity. "The world" is a place where people fight and kill. And Christians aren't to be friends with fighting and killing. "The devil" is using our desires to tempt us into fighting and killing. And Christians are to resist that.
In a world of violence, quarreling, fighting and killing James is very clear:
Friendship with violence is becoming an enemy of God.