Libyan rebels launched a surprise attack Saturday seeking to retake a key oil port 27 miles west of Tripoli on the road that has become the beleaguered capital’s main lifeline.

Government forces appeared to have been caught off guard as the rebels opened fire on troops loyal to Moammar Gaddafi near the city of Zawiyah, which is still recovering from shelling that government forces unleashed there in March to crush a rebel uprising.

“They have been hiding and getting training in the mountains,” said Guma el-Gamaty, a spokesman for the Benghazi-based Transitional National Council, referring to the rebels. “They are making very good progress.”

Saturday’s battles were the closest to the capital in months and raised the prospect that the government’s grip on the coastal road that leads to the Tunisian border could be slipping. If the rebels were to seize control of Zawiyah and nearby towns in coming days, they could cut off already-scant supplies of fuel and food. Gaddafi has come to rely heavily on the two-lane road because a NATO-imposed no-fly zone, near-daily airstrikes on military targets in Tripoli and a naval blockade have left the capital largely isolated.

“I think we’re headed for the finale — the implosion of Tripoli,” Gamaty said.

Moussa Ibrahim, a spokesman for the government, called Saturday’s clashes a “very small fight.”

He told reporters Saturday night in Tripoli that a group of 20 to 25 rebels became “trapped” after engaging government forces. “They do not pose any danger to us,” he said.

It was unclear late Saturday whether rebels had regained crucial territory. Gamaty said he thought government troops were killed in the clashes but could not provide details.

The clashes gave a group of Western journalists a rare unscripted glimpse of the key battleground. Libyan government officials, who have imposed heavy restrictions on Western journalists operating out of a luxurious Tripoli hotel, appeared not to have anticipated the fighting during the daily trip to the border to drop off and pick up reporters.

As they drove west to the Ras Jdir border crossing, 109 miles west of Tripoli, the minders were forced to take a lengthy detour after being warned of the battles ahead by pro-Gaddafi troops at checkpoints along the road.

Once they picked up a new group of journalists entering from Tunisia, the government officials linked up with a police escort as they approached the fighting area — a rare move for such trips. Four armed men in the police vehicle were pointing AK-47 rifles out the windows as the van’s driver and the government minders scanned the road warily.

The towns and villages on the way to Zawiyah appeared nearly deserted, and most shops were closed. Hundreds of Gaddafi forces along the road were clearly on a war footing. They watched the horizon from rooftops and street corners, waved rifles fitted with additional magazines wrapped in duct tape, and blocked off streets with tires and metal pipes.

Some of the men at the checkpoints were in ragtag military uniforms, and many were in civilian clothing.

At one point, a pro-Gaddafi soldier pointed a pistol at the driver of the police escort vehicle, which was trailed by a white van carrying the reporters and a Red Cross convoy. He lowered his weapon after he determined that the police vehicle carried allies. At a checkpoint ahead, other government forces urged the police officer to turn around. As the van made a U-turn, gunfire crackled nearby.

When asked about the commotion along the road, a government minder told reporters, “Road work.”

Also Saturday, shelling continued to intermittently target towns on the western outskirts of the rebel-held port city of Misurata, 131 miles east of Tripoli, the Associated Press reported. No NATO aircraft were reported in the vicinity.

Correspondent Simon Denyer in western Libya contributed to this report.