CAIRO — They waited in long lines for hours to vote, despite a new wave of unrest, fears about a sharply divided society and uncertainty over the nation’s future.

For the millions of Egyptians who cast ballots Monday, the first parliamentary elections since they ousted Hosni Mubarak were a turning point in history — if for no other reason than they were finally getting a chance to be heard after decades of rigged voting.

The outcome will indicate whether one of America’s most important Middle East allies will remain secular or move down a more Islamic path, as have other countries swept up in the Arab Spring.

“I have hope this time,” said Amal Fathy, a 50-year-old government employee who wears the Islamic veil. “I may not live long enough to see change, but my grandchildren will.”

Since the uprising that forced out Mubarak nearly 10 months ago, Egyptians had looked forward to this day as a celebration of freedom after years of stifling dictatorship. Instead, there has been deep disappointment with the military rulers who replaced the old regime and a new wave of protests and clashes that began 10 days before the vote.

Adding to the disarray, the multiple-stage election process, which will stretch over months, is extremely complicated. Some of the key political players complained they did not have enough time or the right conditions to organize for the vote.

If there was little jubilation, there was hope — and even defiance — with many determined to either push the military from power or vote against the Muslim Brotherhood and other Islamist groups who are expected to dominate the balloting.

“This was simply overwhelming. My heart was beating so fast,” Sanaa el-Hawary, a 38-year-old mother of one said after she cast her vote in Cairo. “This is my life, it’s my baby’s life. It’s my country and this is the only hope we have now.”

Female voters appeared to outnumber the men by far, shattering widespread notions in a society whose women are mostly dismissed or taken lightly.

Women waiting for five hours at one polling center chanted: “We will not give up, we will not give up.”

In Cairo’s crowded Shoubra district, Toka Youssef, 34, explained why she was voting for the first time in her life.

“Before, there were no real elections. It was all theater. Now I’m optimistic in the future. These are the first steps toward democracy,” she said. “It’s a bit confused and chaotic because we’ve never seen this many people vote. No one cared this much before.”

Ever since an 18-day uprising toppled Mubarak’s regime and brought the military to power, Egypt has gone through violence, splits in society, a worsening economy and a surge in street crime. Still, people were eager to cast a free vote, even though much is unclear about what will happen next.

Many liberals, leftists, Christians and pious Muslims who oppose mixing religion and politics went to the polls to try to reduce the scope of the Muslim Brotherhood’s electoral gains.

Also weighing heavily on voters’ minds was whether this election will set Egypt on a path of democracy under the rule of the military. Protests this month have demanded that the generals step down immediately because of fears they are trying to cling to power and not bring real reform.