Let A be local ring in which 2 is invertible and let n be a non-negative integer. We show that the nth cohomological invariant of quadratic forms is a well-defined homomorphism from the nth power of the fundamental ideal in the Witt ring of A to the degree n etale cohomology of A with mod 2 coefficients, which is surjective and has kernel the (n + 1)th power of the fundamental ideal. This is obtained by proving the Gersten conjecture for Witt groups in an important mixed-characteristic case.