It was a scene evoking bad memories of a bloody era in a country with a recent history of authoritarianism and civil war.

Soldiers in combat fatigues marched into El Salvador’s parliament, before the country’s popular young president, Nayib Bukele, sat down in the speaker’s chair and gave the assembled deputies an ultimatum: approve a loan for new security equipment or be summoned back in seven days for another session.

“Pray,” he told supporters. “Ask God to grant us patience for a week.”

The episode last weekend stunned El Salvador, where memories are still vivid of the 1979-1992 civil war between US-backed military dictatorships and leftist guerrillas.

“I lived the war as a child, so it seemed incredible – something out of movie or some sort of farce,” said Juan Meléndez, El Salvador director of the Netherlands Institute for Multiparty Democracy.

Bearded, millennial and fond of slick suits, Bukele has captured international attention with his social media skills and a penchant for publicity stunts – even taking a selfie during his speech to the UN general assembly.

Bukele, 38, a former mayor of the capital, San Salvador, won a landslide victory last year on the promise of cracking down on corruption and improving security.

El Salvador has a population of just 6.45 million, but rampant gang violence, corruption and extrajudicial executions have helped push its murder rate to one comparable with a country at war.

His popularity hit a staggering 91% shortly after taking office and he has 1.3 million Twitter followers.

But the episode at the assembly has cast a critical spotlight on the young president, and raised fears that his public persona is cover for authoritarian tendencies.

“For the first time in his career, he wasn’t the ‘cool’ president for the international community,” said Óscar Martínez, an editor with the digital newspaper El Faro.

President Nayib Bukele arrives at a graduation ceremony for new police officers in San Salvador on Tuesday. Photograph: José Cabezas/Reuters

In a blistering editorial, El Faro said: “With the military takeover of the assembly, Nayib Bukele laid to rest the last doubts about his character: he is showboating, populist, anti-democratic, and authoritarian. With the cheapest tricks – vile, dangerous, and claiming he has God on his side – he turned over a dark page in the history of our young democracy.”

Bukele had tried to convene a special session of the assembly so lawmakers could approve a $109m loan to pay for security equipment, including police vehicles, uniforms, surveillance equipment and a helicopter. But the deputies called for more time to study the issue.

The country’s supreme court later ordered Bukele to abstain from using the military “contrary to constitutional purposes and which jeopardise the republican, democratic and representative form of government”.

Analysts say Bukele purposely picked a fight with a pair of the least popular institutions in the country: the assembly and traditional political parties.

Bukele won election by portraying himself as an outsider who had come to clean up the mess left by successive governments (on the left and right) in the postwar period, said Sonja Wolf, an El Salvador expert at the Cide university in Mexico.

“His popularity is making him a little arrogant,” she said.

Bukele has promised to end the violence, launching a program known as the “territorial control strategy” to achieve it.

But analysts say the plan seems reminiscent of the iron-fisted approach employed by previous presidents.

“Nobody has seen this plan,” Wolf said. “We don’t even know if a document exists, which explains what the plan is.”

El Salvador has seen a sharp decline in homicide rate since Bukele took office, however, from 8.8 per day to just 3.8 per day in 2020. The sudden drop has prompted some observers to speculate if the government had copied another tack from his predecessors and opened negotiations with the powerful gangs – something Bukele denies.

“I’m not saying that he’s negotiated. I’m not saying that he hasn’t negotiated,” said a Catholic source in El Salvador. “But the only other time we saw this kind of dramatic drop was when there was a negotiated truce [with the gangs] back in 2012.”