A convoy of 300 armored personnel carriers, tanks and trucks began the Soviet Union's withdrawal from Afghanistan with a harrowing, eight-hour ride through rebel-infested mountains that ended safely in Kabul.

The withdrawal began Sunday at about 7:30 a.m., when 1,200 Soviet troops abandoned the Afghan army garrison in the strategic eastern town of Jalalabad and boarded the vehicles for the more than 60-mile ride west to Kabul, officials said. The convoy reached the capital by late afternoon, encountering no resistance from U.S.-armed Moslem rebels.Soviet officials said the convoy would stop in Kabul for the night to refuel and, after a parade Monday, leave on its more than 180-mile journey north on the Salang Road to the Soviet border.

Soviet Col. Alexander Dubrilin told reporters there had been no casualties among the 1,200 soldiers who left Jalalabad early Sunday.

Afghan President Najibullah reviewed the 300 vehicle convoy upon its arrival in Kabul. The Soviet soldiers, covered in grime and weary from their journey, appeared elated to be leaving a country one trooper described as a "beautiful, but terrifying place."

Security was strict on the one-lane road linking the heavily defended Afghan capital with Jalalabad. Afghan soldiers swept the dusty verge for mines, and Soviet soldiers and armored personnel carriers and tanks were positioned at intervals along the way.

Flights of rocket-laden Soviet helicopter gunships were seen clattering from the Kabul airport toward Jalalabad, apparently to provide air cover for the convoy, which stretched about a half-mile.

The road into Kabul was closed to private traffic. Soviet and Afghan flags hung from lampposts on the route into the city, and walls and traffic circles were adorned with billboards and banners proclaiming "Long Live Afghan-Soviet friendship" and welcoming the returning Russian soldiers.

Reporters who rode with the convoy Sunday said shooting was heard in the distant hills.

The terror of the trip was replaced in Kabul by cheers and applause from hundreds of Afghan government soldiers, who greeted the Russian with hugs and gifts of paper garlands and flowers for their rifle barrels.

Few Afghan civilians joined in Sunday's celebration. Most were children who waved and shouted, "Bye-bye." Adults mainly squatted or stood watching the welcome impassively, their faces frozen in ambivalence.

The Soviet Union, which invaded Afghanistan in December 1979, agreed to withdraw its forces beginning Sunday under U.N.-mediated accords signed April 14 in Geneva with Afghanistan, the United States and Pakistan.

Western estimates put the number of Soviet troops in Afghanistan at 115,000 soldiers backing the 40,000-strong Afghan army against rebel forces armed by the United States, China, Western European nations and Middle Eastern states.

More than 1 million Afghans are estimated to have been killed in the conflict and another million wounded.

Like the American forces in Vietnam, the Soviet Union, despite its advanced military technology, failed to crush the fiercely devoted rebels.