  Carbon is an essential element for the existence and evolution of life on
Earth. Its abundance in Earth's crust and mantle (the Bulk Silicate Earth, BSE)
is surprisingly high given that carbon is strongly siderophile (metal-loving)
at low pressures and temperatures, and hence should have segregated almost
completely into Earth's core during accretion. Estimates of the concentration
of carbon in the BSE lie in the range 100-260 ppm and are much higher than
expected based on simple models of core-mantle differentiation. Here we show
through experiments at the putative conditions of Earth's core formation (49-71
GPa and 3600-4000 K) that carbon is significantly less siderophile at these
conditions than at the low pressures ($\leq$13 GPa) and temperatures
($\leq$2500 K) of previous large volume press studies, but at least an order of
magnitude more siderophile than proposed recently based on an experimental
approach that is similar to ours. Using our new data along with previously
published results, we derive a new parameterization of the pressure-temperature
dependence of the metal-silicate partitioning of carbon. We apply this
parameterization in a model that combines planet formation and core-mantle
differentiation that is based on astrophysical N-body accretion simulations.
Because differentiated planetesimals were almost completely depleted in carbon
due to sublimation at high temperatures, almost all carbon in the BSE was added
by the accretion of fully-oxidized carbonaceous chondrite material from the
outer solar system. Carbon is added to the mantle continuously throughout
accretion and its concentration reaches values within the BSE range (e.g.
140$\pm$40 ppm) at the end of accretion. The corresponding final core and bulk
Earth carbon concentrations are 1270$\pm$300 ppm and 495$\pm$125 ppm
respectively.
