There is a narrow footbridge overlooking the entrance to the ministry of defence in the Abbasiya district of Cairo. On Friday afternoon, this crowded bridge provided the best view of the frontline in the latest round of violent clashes between the army and demonstrators who suspect the country's ruling generals of wanting to hold on to power.

On one side of a ring of barbed wire, soldiers hurled bricks and fired tear gas. Below the bridge, the protesters facing the soldiers threw their own missiles, while others removed the injured on motorbikes or carried them limp on their shoulders, some insensible, others spattered in blood.

I bumped into Hazem Abdel Rahman, a young protester, drenched in sweat, holding his injured arm. "I came here this morning and everything was peaceful. People linked arms to keep the crowd back from the ministry of defence. But then after Friday prayers people came who we did not know and infiltrated our demonstration and started throwing stones," he said.

Others say the trouble started after some protesters were grabbed by the soldiers trying to cross the wire. A few minutes after I spoke to Hazem, the first sound of live gunfire rang out, driving the protesters back in panic. I ran, but found myself trapped between two groups of soldiers, forced to climb several walls and cross a railway line to escape, only to be confronted by an angry group of supporters of the military.

"You are a spy," one shouted, attempting to drag me away for questioning, prevented in his efforts by the intervention of other residents. Other journalists covering events in Abbasiya in the last few days have not been so fortunate. Eighteen have been arrested or injured, including one who reportedly had an ear cut off during an attack.

Egypt's long-awaited presidential elections – the first round of which begins on 23 May – appear to be unravelling amid rising violence and protest. By the end of Friday, two people were dead, including a soldier; hundreds had been injured or arrested; and a curfew had been imposed by the army in the area where the violence was worst.

Once again, the most significant faultline of the protests – one that threatens to overshadow the election campaign – has been the growing rift between the generals and the political parties who would replace them when – or rather if – the army relinquishes power, as it has promised to do, on 30 June.

Some of those out protesting on Friday have special reason to despise them. In Tahrir Square a few hours before the violent dispersal of the protest in Abbasiya, I had met Mohammed Atta, a 45-year-old tour guide. He had been in Abbasiya on Wednesday and witnessed the baltagiya – well-organised gangs of armed thugs – attack a sit-in dominated by ultra-conservative Salafi Muslims and supported by revolutionaries, outside the defence ministry. That day at least 11 people died, many shot in the head at close quarters.

I encountered Atta attending a protest in the square called by the Muslim Brotherhood to protest at those killings. "I was in the middle of the street [in Abbasiya] when they came in from one end," Atta recalled. "I saw them come out from where the police were."

Atta fled, chased by 12 men. He left behind him the body of his murdered friend, Atif al-Gohary, a 41-year-old chef. "He went over to talk to them, to ask them to be peaceful," he recalled. Instead, al-Gohary was shot in the chest and his face was stamped in.

"He was like a brother to me. He taught me about revolution. On 25 January last year when I came here to Tahrir Square at the beginning of the revolution, I was afraid to go beyond the police lines. But he called me down to join him and told me not to be afraid."

Atta had come to Tahrir Square on Friday to participate in the millioneya – the million-man protest organised by the Muslim Brotherhood and other parties to call on Egypt's military council, which has ruled since the fall of dictator Hosni Mubarak more than a year ago, to keep its promise and stand down.

But if the Brotherhood had hoped to pack the square that became the symbol of the resistance to both the Mubarak regime and military rule, they were to be disappointed, despite bussing in supporters from hundreds of miles away. The Brotherhood, once regarded as Egypt's most organised and potent political force, has begun to wane.

As the election nears, Egypt's fragile transition to democracy is slipping into turmoil. It is not just the killings, or the repetition of the generals' heated denials – on Thursday they insisted that they had nothing to do with the bloodshed, had no preference for who should be president, and had no desire to cling to power. It is that the process that was supposed to deliver a transition to democracy appears to have been undermined at almost every turn by Egypt's de facto rulers, creating a growing sense of disillusionment, not only with the army, but with parties such as the Brotherhood.

Candidates have been disqualified, including the Brotherhood's own first choice, Khairat al-Shater, and Hazem Abu Ismail, the ultra-conservative whose supporters were gunned down and stabbed to death in Abbasiya on Wednesday. There have been rumours of postponements to the elections, sourced to the army; complaints to the electoral commission against the candidates who remain; and dishonest reporting of events by a state media still dominated by those once loyal to the old regime.

For those like Atta, who describes himself as an "independent revolutionary" but who joined the Brotherhood's protest last week, the aim of the generals has been to turn the different parties who have participated in the revolution against each other.

Location of Alexandria in Egypt.

In Egypt's political and social upheaval, Cairo's frontlines can be places of grim and gripping drama. But the violence and anger can be distracting, limiting both dialogue and an understanding of what is happening.

To learn what is going on in Egypt's increasingly febrile politics, it sometimes feels better to leave Cairo for another Egypt, one that is not so tightly defined by the revolution's psycho-geography.

On the Wednesday of the killings, I travelled to Alexandria, Egypt's second city and the centre of the Salafist movement challenging the Brotherhood for support among Islamist voters.

The road to the coast passes through a flat countryside punctuated by conical white pigeon lofts. Alexandria itself, once famous as Egypt's most cosmopolitan city, has decayed after years of neglect, appearing like something sea-spoiled and cast onto the shore.

Away from Cairo it is easier to detect the subtle and nuanced divisions that have emerged in the country's fresh-minted politics, which – while often hostile to the generals – also harbours a growing suspicion about the motives of the major political players.

Context is important in a political process that seems increasingly flawed and lacking in independence. Egypt's military controls large parts of the economy, despite its promise to withdraw. It influences the state media. A large part of the judiciary and key institutions in the transition process, including the electoral commission, are suspected of being unduly influenced by the generals.

The reality is that the Supreme Council of the Armed Forces (Scaf) is a dominant, unspoken presence not only in Egypt's presidential elections but in its new political system. All parties are forced to negotiate the generals' continuing presence – and, increasingly, they are judged by how they do that.

And it is the Muslim Brotherhood – and its Freedom and Justice party – that has struggled most in this respect. With al-Shater disqualified, its "spare candidate", as Mohammed Morsi has been disparagingly called, has shown himself lacking in charisma and appeal. There is also growing suspicion of the party's desire to monopolise power, having previously said it would not field a candidate. And the message of Morsi, a Brotherhood functionary, has seemed more tailored to reassure the movement's membership than appeal to a wider audience, perhaps explaining its failure to attract more support from outside its ranks to its protest on Friday.

Perhaps even more toxic, however, is the widespread charge – also levelled by some younger Brotherhood activists – that by avoiding a confrontation with the generals, even in the midst of violent clashes late last year, it has at best let Scaf off the hook, at worst somehow collaborated with it. But the desire among the Islamist parties to avoid conflict with the generals runs deep.

I met Ashraf Thabet, deputy speaker of the Egyptian parliament, and a leading figure in the Salafist Al-Nour party, climbing the stairs of his Alexandria office with a bag bulging with cans of juice.

Smart in a grey suit and pale lilac tie, Thabet is cautious about apportioning blame. "We are still trying to understand what happened, who was responsible," he said. "We're watching. There is a crisis but I hope it will pass so that the elections will take place." It is the greatest fear of many, both in the Brotherhood and other parties, that a crisis such as this – a manufactured one, perhaps – could lead to wider political conflict and the postponement of the elections.

Adding to the recent woes of the Muslim Brotherhood is the fact that Thabet's Al-Nour party, along with others, has thrown its weight not behind Morsi, but behind Abdel Moneim Abul Fotouh, a former member of the Muslim Brotherhood who split with the party while still backing its broad aims.

Thabet spelt out the criteria for this decision: "efficiency"; Abul Fotouh's views on Islam; and, crucially, his level of support among voters. "The new president must be strong," he said. With an implicit swipe at Morsi and the Brotherhood, he added: "He must be for Egypt and not beholden to any particular party or faction."

There are other issues. The lack of a new constitution has undermined the legitimacy of a transitional process in which the eventual balances of power and responsibility are still unclear.

Elsewhere in the city, in an apartment in the Janklis district, Ahmad Galal, a fine art student, sits with his friend Mustafa Sakr, a commerce student, and helps a colleague with her sketching. A revolutionary socialist, he reflects the views of many more liberal activists in Egypt today. "It's a mess," he said. Asked who he believed was responsible for the killings last week, he said: "Of course it was the military."

He believes both the Muslim Brotherhood and Salafists have "played dirty" during the hoped-for transition to civilian rule, directing most of his contempt at a Brotherhood he believes has done deals with the generals. "I must say I'm not optimistic, but I think the elections will take place as planned. People had huge hopes and nothing has come of it."

In Alexandria I talked to nationalists, the Brotherhood and even a human rights activist with a lingering respect for Mubarak – although she was quick to insist that she opposed him.

Perhaps what was most striking in these conversations was not the different accusations levelled by all sides – sometimes fantastical, sometimes only too credible – but how, in 14 months of revolution, Egypt's politics has become contaminated with an all-pervading sense of distrust. It is precisely this, many Egyptians insist, that has been the military's intention – to spread distrust and division and deliberately foster the sense of crisis predicted by Mubarak himself not long before his fall – that what would follow him is "chaos".

Whether you believe that claim or not – and there appears to be some evidence for it – something else important has changed since Mubarak's fall. The revolutionary spaces in Cairo in particular, such as Tahrir Square, have not remained above the factionalising influence of politics.

Friday's demonstration in Tahrir seemed more like a Brotherhood rally rather than a protest against the midweek deaths at the defence ministry, designed to rebuild the party's standing in face of the accusations levelled against it. To show – as someone said to me – that it "stands with the people".

Every other baseball cap bore the Brotherhood's crest – as did green-paper solar topees and plastic badges bearing the image of Morsi. In the square, Midhat Ramadan, a secondary school teacher from Mansour, admitted that in not confronting the violence against protesters late last year, his movement made a mistake that might have damaged its standing. "Yes. It was wrong for us to remain silent. We had to change tactics – which is why we have come to the square again," he said.

It is a reflection both of the new weakness afflicting a Brotherhood that not so many months ago appeared unstoppable, and the new uncertainties afflicting Egypt's politics. Whatever happens in the next three weeks, and in the months that follow, Ahmad Galal, the Alexandria art student, is right. It will be very messy.