The final stage of the accretion of Uranus and Neptune is numerically investigated. The four Jovian planets are considered with Jupiter and Saturn assumed to have reached their present sizes, whereas Uranus and Neptune are taken with initial masses 0.2 of their present ones. Allowance is made for the orbital variation of the Jovian planets due to the exchange of angular momentum with interacting bodies ("planetesimals"). Two possible effects that may have contributed to the accretion of Uranus and Neptune are incorporated in our model: (1) an enlarged cross section for accretion of incoming planetesimals due to the presence of extended gaseous envelopes and/or circumplanetary swarms of bodies; and (2) intermediate protoplanets in mid-range orbits between the Jovian planets. Significant radial displacements are found for Uranus and Neptune during their accretion and scattering of planetesimals. The orbital angular momentum budgets of Neptune, Uranus, and Saturn turn out to be positive; i.e., they on average gain orbital angular momentum in their interactions with planetesimals and hence they are displaced outwardly. Instead, Jupiter as the main ejector of bodies loses orbital angular momentum so it moves sunward. The gravitational stirring of planetesimals caused by the introduction of intermediate protoplanets has the effect that additional solid matter is injected into the accretion zones of Uranus and Neptune. For moderate enlargements of the radius of the accretion cross section (2-4 times), the accretion time scale of Uranus and Neptune are found to be a few 108 years and the initial amount of solid material required to form them of a few times their present masses. Given the crucial role played by the size of the accretion cross section, questions as to when Uranus and Neptune acquired their gaseous envelopes, when the envelopes collapsed onto the solid cores, and how massive they were are essential in defining the efficiency and time scale of accretion of the two outer Jovian planets.