IT IS a long way from Tripoli to Caracas. But although Hugo Chávez, unlike his friend and close ally Muammar Qaddafi, is an elected president, there are some striking similarities between the Libyan and Venezuelan regimes. Mr Chávez's grassroots “communes” resemble Colonel Qaddafi's “people's committees”, for example. And a new decree, published last month, speeds up the creation of a sectarian militia like that which opened fire against unarmed protesters in Libya.

A year ago Mr Chávez assembled more than 30,000 uniformed, gun-toting militiamen and women for a parade in the centre of Caracas. Unsheathing a sword that belonged to Simón Bolívar, Venezuela's independence hero, he led them in an oath to work tirelessly to “consolidate…the socialist revolution”. Officials claim that the militias total 125,000, and that the goal is to reach 2m. Sceptics put the number trained so far at under 25,000.

Under the new law, the Bolivarian militia will now have its own officers and will be commanded directly by the president. That is something the army previously resisted. But General Carlos Mata Figueroa, the defence minister, insists that the militia is a “complementary”, not parallel, force. According to Carlos Escarrá, a chavista legislator, it is “disingenuous” of opponents to suggest that the militia “will be a sort of praetorian guard for the president”.

Mr Chávez's own statements suggest otherwise. The president has always said that his leftist “revolution” is “peaceful, but armed”, and that violence would ensue if it were to be thwarted. In December 2012 he faces a presidential election which opinion polls suggest he might lose. But both he and his top general, Henry Rangel Silva, have said that the armed forces would resist the orders of a post-Chávez government. According to General Rangel, the high command is “wedded to the political project” of Mr Chávez.

The officer corps may not be. A recently retired military dissident says only 10% are unconditional chavistas, with 20% constitutionalists and the rest pragmatic. If so, Mr Chávez's decision to strengthen his paramilitary force may make sense to him. But it bodes ill for peace in Venezuela.

Like Colonel Qaddafi, Mr Chávez also has foreign fighters he may be able to count on in a fix. Venezuela has an unknown number of Cuban military advisers. Some sources say the Cubans give orders and (with Russians) run the intelligence service. But tens of thousands of Cubans, all with military training, have been deployed across the country as medical staff, sports instructors and the like. Many have defected and fled abroad. But some might defend the revolution, guns in hand.

Such a scenario is an explicit part of the government's planning. Mr Chávez claims, and may even believe, that “the empire” (ie, the United States) is seeking an excuse to topple him by force. Colonel Qaddafi, he declared, “is doing what he has to do, resisting imperialist aggression”. The doctrine of Venezuela's armed forces now includes a version of what Cuba calls “the war of all the people”. In theory, all Venezuelans must train to resist an occupier.

Many Venezuelans fear that the militia is really aimed at Mr Chávez's domestic opponents. The president accuses the opposition leadership, almost daily, of being a fifth column for foreign capitalists desperate to grab the country's oil. From there, it is a short step to imagining the chavista militia, armed with Russian Dragunov sniper-rifles, taking aim at counter-revolutionaries. “It is not possible to stage an unarmed revolution against this bourgeoisie,” Mr Chávez told his militia rally last year. Mere bravado, perhaps, but many Venezuelans fear he may be serious.