When Muammar Gaddafi's government shut off the cellphone network in Misrata in the early days of Libya's uprising, it wanted to stop rebel forces communicating with each other. But the power of a modern phone goes beyond its network.

Both rebels and government soldiers have used their phones to take pictures and videos of the conflict, a digital record of fighting from both sides. With the rebels now in Tripoli, the capital, and Gaddafi's whereabouts unknown, those gigabytes of potential evidence may play a role in any war crimes cases.

The International Criminal Court's chief prosecutor Luis Moreno-Ocampo made an appeal in February for footage and images to confirm the alleged crimes, after the United Nations Security Council referred the Libyan uprising to the court. A court filing applying for arrest warrants listed video evidence, mainly from media, but also from unspecified sources, in support of its claim.

In the Mediterranean city of Misrata, in particular, a group of rebel-allied lawyers has worked to gather evidence of what it calls war crimes committed by Gaddafi forces.

In the beginning when there were snipers we had to move around carefully, said Omar Abulifa, a former prosecutor and head of the Misrata-based Human Rights Activists Association. It was hard to get the evidence, but we did what we could.

As the rebels gained control of more of the city in April and May, the association set up a system to gather evidence after every incident, especially the continued bombardment of the city with Grad rockets by Gaddafi loyalists, which killed and injured many civilians. The footage they gathered includes videos taken from the cellphones of rebel fighters and from those of government troops captured or killed during the fighting. Other video and photographs came from citizens of the town.

Some of that film can be used as evidence, Abulifa says. But not all of it because to be used as evidence it has to be from a trusted source and it has to be clear what is happening.

Around 150 gigabytes of video gathered by the city's media committee, which was set up after the uprising, has been provided to the association. A member of the committee gave a Reuters reporter who was in Misrata in July a large volume of that material.

Everyone has stuff like this, said Ali, 21, an off-duty rebel fighter, as he showed a Reuters reporter videos on his touch-screen phone, including one of government tanks entering Misrata and one showing a man he says was an unarmed doctor who had been shot by Gaddafi troops and bled to death in the street.

Hair slicked back, and impeccably turned out in western jeans, shirt and shoes, Ali speaks in the weary tone of a young man explaining modern technology to someone older.

Just ask anyone and they'll show you, he said.

GRILLED FISH

Technology has been vital to Misrata's uprising since the beginning.

When his closest childhood friend invited him to a dinner in a fisherman's hut on the beach last December, Ayman Al Sahli was puzzled. As the 31-year-old lawyer and six other men tucked into grilled fish, their friend, Mohammed Al Madani, explained why he had called the group together.

The accountant brought out a photograph of the old Libyan flag, which predates Muammar Gaddafi's seizure of power in a 1969 coup. The red-black-and-green flag with its white crescent moon and star is now ubiquitous in the rebel-held city and other parts of Libya. But in December it was forbidden so a small, easily hidden photograph had to do.

Al Madani then used his mobile phone to play Libya's old national anthem. The song dates back to the country's independence in 1951 and was banned after Gaddafi seized power. None of the men present had ever heard it before.

We spent the rest of the evening talking about the unrest in Tunisia, al Sahli says, and about what Libya would be like without Gaddafi.

In the six months since they rose against Gaddafi, the 500,000 or so residents of Libya's third largest city have remained close to one of the fiercest frontlines of the Arab Spring. The rebels seized Misrata in May after a bloody, three-month long battle against well-armed government militia and in the past few weeks forced the government troops west toward Tripoli.

With the rebels on the verge of victory, much is likely to be made of the NATO bombing raids, which have hammered Gaddafi's forces since March, and the role of Qatar, which has financed the rebels. But just as important have been two things on show that night in the Misrata beach hut: a low-tech, make-do resourcefulness and mobile phones.

FACEBOOK EVENT

A few days before Misrata's first street protest on February 17, Mohammed Agila, 32, a bespectacled bank employee, took his heavily pregnant wife and two children to her parents' house. He withdrew all the money from his bank account and gave it to his father-in-law.

I did not know exactly what would happen when we went out in the street, said Agila, one of 70 or so participants in that initial demonstration. But I knew I could be arrested.

In the preceding months, Agila and Jamal Sibai, who also took part in the first protest, joined small group meetings like the one at the fisherman's hut.

People met in groups of 10, 11, 12 and talked about going into the streets to demonstrate, said Sibai, 25, a slender, bearded art student and now a writer for a new newspaper called Free Libya. We talked about freedom and the need for a constitution. We talked about how we wanted a president who could only serve for four or eight years and then, 'Thank you, goodbye.'

We didn't talk about fighting, he added. We just wanted the things a normal country should have.

In January, two Facebook pages -- Amal Libya or Hope Libya, and another calling for a day of anger on February 17 -- helped protesters like Sibai and Agila realize they were not alone.

Before the Facebook pages, we did not know exactly when or where we should go out into the streets, Agila said. But they told us when and where to do it. We didn't create the revolution in Misrata, added Agila, now a radio announcer as well as working at a bank. Everyone here wanted to do what we did. We just happened to do it first.

By this time Tunisia's Zine al-Abidine Ben Ali and Egypt's Hosni Mubarak had already been toppled and protests were underway in Syria, Yemen, Bahrain and other countries. Protests began in Benghazi on February 15, because of fears Gaddafi was preparing to send in his militia.

When protesters, most of them strangers to each other, showed up in the parking lot of Misrata's technological college on February 17, they noticed cars carrying Gaddafi's secret police and militia waiting for them. All the protesters were arrested.

I was afraid, Sibai said. But I knew I had to do this anyway.

TAKING IT IN TURNS

The first protests sparked off a series of increasingly large demonstrations in the city, Libya's commercial and industrial heart some 200 km (124 miles) east of Tripoli. Government forces opened fire on protesters on February 19. Rebels armed with Molotov cocktails, hunting rifles and crude, home-made blades, took control of the city within a few days, but barely.

On March 17, the same day a United Nations resolution ushered in a NATO bombing campaign, Gaddafi forces began an artillery bombardment. Within a few days government tanks backed by snipers firing from tall buildings on Tripoli Street, the city's main thoroughfare, had forced the rebels to hole up in the city's seaport.

We had no weapons, so we fought with what we could find, says Abu Youssef, 55, a former caterer who recalls his amazement when he saw a teenager take out a tank in the early days of the uprising with just a Molotov cocktail.

On the ground, men like Youssef, 37, a former truck driver on the city's southern front, joined small groups of men. The group Youssef joined had just one gun between them, a common situation in the opening days of the war before the city's entrepreneurs, and mass fundraising efforts, brought weapons and ammunition.

Some weapons came from the temporary rebel capital of Benghazi in the east, but the fact that most were bought by locals is both a source of pride and a bone of contention with Benghazi.

We would take it in turns to fire the gun, Youssef says while taking shade from the fierce late July sun with his comrades. The rest of us would help the man with the gun.

Another fighter called Alim, 21, said rocket-propelled grenade launchers, a much-needed weapon against Gaddafi's more heavily armed forces, were in particularly short supply. When a group without a launcher needed one for an attack they would ask other groups in the neighborhood to borrow theirs.

Once we fired it, we returned it as promised, Alim said as he sped toward the front line last month in a Chinese-made pickup, one of several thousand commandeered from the city's port during the uprising.

Imported by the government a few years ago to sell to Libyans, the Toyota-lookalikes were rejected by consumers as too shoddy and sat idle at the port. Now they are a hot commodity. The trucks have to be hotwired to start, because no one knows where the keys are, and have a notoriously loose tailgate that pops open at inopportune moments.

I'd rather have a Toyota, Alim says, as he hotwires the truck. Or any other half-decent truck. But I'll make do with this.

DOG FIGHT

The citizens of Misrata made do with whatever came to hand in a battle where, perhaps surprisingly, tanks were not the biggest threat the rebel fighters faced. In the city, we could use the houses and buildings to get close to tanks, says Ali, 29, a dentist on the western front line. We found out that we could take out a tank at 80 meters.

Far worse were the snipers.

On a tour around the damaged University of Misrata's Faculty of Medical Technology, medical management lecturer Mahmoud Attaweil pointed to the holes knocked by government snipers in the roof of a five-storey building. Holes along the side of the building were caused by rebels trying to dislodge the snipers, said Attaweil.

You can't get a sniper out of a building with small arms, he said. The only way to persuade him to leave is to make him believe you will bring the whole building down if you have to.

One group of rebel fighters attached flashlights to the heads of dogs at night then released them near buildings where they suspected a sniper was hiding. The sniper would open fire, almost invariably missing the fast-moving target presented by the running dog. Once the sniper had given away his position, the rebels would open fire with rocket-propelled grenades.

GIGABYTES OF EVIDENCE

Mobile phones also became a weapon.

Much of the footage of fighting and its aftermath held by the rebels is too graphic for Reuters to show.

In one sequence, people run toward a car and open the door. The vehicle's driver slumps out of the door, shot through the head by a sniper, his brains spilling out of a hole in his forehead. Many others, from the city's hospitals and clinics -- a trusted source of information -- show injured children. One clip shows a bombed incubator room for infants where nurses pull glass out of the bloodied bodies of crying babies.

Another video, purportedly taken from the phone of a captured government soldier, shows what appear to be uniformed Gaddafi loyalists in the back of a truck trying to force a group of men mainly in civilian clothes to Say Muammar! and Say something!. Two of the civilians are assaulted -- the first, a bearded man, is repeatedly slapped in the face, and pushed against the side of the truck by a man in a black coat. The second is slapped in the face. The men then all begin to chant Long Live Muammar's lions!

The Misrata group says it has already started work on 150 war crimes cases against the Gaddafi regime, and Abulifa says it will add many more.

Gaddafi's government has denied anything beyond firing at the armed gangs and mercenaries, and in June angrily rejected charges of crimes against humanity filed by the International Criminal Court against the Libyan leader, his son Saif al-Islam and intelligence chief Abdullah al-Senussi.

While Abulifa says he welcomes the ICC's war crimes charges, if the country's longtime ruler is captured he says he wants him to stand trial in Libya. When asked why, he pauses, then leans forward in his chair and speaks slowly.

The ICC does not have the death penalty, he says. Libya does. We want Gaddafi brought to trial. We want the world to see what he has done. And then we want him brought to justice.

The ICC said the possible admissibility of mobile phone footage as evidence would be decided on a case-by-case basis. If there is a conversation from the defense about certain evidence it is up to the judges to decide the admissibility of that evidence, ICC official Fadi el-Abdallah said.

THE REVOLUTION DID NOT KILL HIM

The rebel flag flies everywhere in Misrata now. It is painted on lamp posts, empty oil drums and even the old cargo containers that serve at increasingly irrelevant checkpoints in the city. The people of Misrata boast of how quickly law and order has been restored to the streets -- a feat more elusive for Benghazi, Libya's second city and home to the National Transitional Council, the ruling body for the parts of the country under rebel control.

Today, too, everyone knows Libya's old national anthem.

But while Ayman Al Sahli, who first heard that anthem on the mobile phone of his friend Mohammed Al Madani last December, says he still backs the revolution, he mourns the loss of his friend, who was killed near the frontline on April 27.

When the fighting began, the accountant who had arranged the beach hut dinner began working for the rebel-run radio station in Misrata, making frequent trips to the station to report on the latest events at the frontline. Al Sahli was sitting with him and other friends when a mortar fired by Gaddafi loyalists struck, killing Al Madani instantly.

The revolution did not kill Al Madani, Gaddafi did, Al Sahli said. More than anything, I want Libya to be free. But I lost my joy the day my friend died.

(Nick Carey reported from Misrata in July; additional reporting by Aaron Gray-Block in Amsterdam; Edited by Simon Robinson and Sara Ledwith)