I've located my first city next to a Barbarian village and generated many militia a couple of times.
They are good for blocking ai travelling (unless they decide to fight), discovering the land, and I also use them to support spies.
If I land a spy, it invariably gets captured, but if I land a spy and a militia or two, the AI have to fight the militia first. Next turn I can move the spy into the city.