The 292-day Richmond–Petersburg Campaign (Siege of Petersburg) began when two corps of the Union Army of the Potomac, which were unobserved when leaving Cold Harbor at the end of the Overland Campaign, combined with the Union Army of the James outside Petersburg, but failed to seize the city from a small force of Confederate defenders at the Second Battle of Petersburg on June 15–18, 1864. Union General-in-Chief Ulysses S. Grant then had to conduct a campaign of trench warfare and attrition in which the Union forces tried to wear down the smaller Confederate Army, destroy or cut off sources of supply and supply lines to Petersburg and Richmond and extend the defensive lines which the outnumbered and declining Confederate force had to defend to the breaking point. The Confederates were able to defend Richmond and the important railroad and supply center of Petersburg, Virginia, south of Richmond for over 9 months against a larger force by adopting a defensive strategy and skilfully using trenches and field fortifications.