The isotopic ratio of nitrogen measured in primitive Solar System bodies shows a broad range of values, the origin of which remains unknown. One key question is whether these isotopic reservoirs of nitrogen predate the comet formation stage or are posterior to it. Another central question is elucidating the processes that can produce the observed variations in the 14 N/ 15 N isotopic ratio. Disks that orbit pre-main-sequence (TTauri) stars provide unique opportunities for observing the chemical content of analogs of the protosolar nebula and therefore for building a comprehensive scenario that can explain the origin of nitrogen in the Solar System and in planetforming disks. With ALMA, it has become possible to measure isotopic ratios of nitrogen-bearing species in such environments. We present spectrally and spatially resolved observations of the hyperfine structure of the 4-3 rotational transition of HCN and its main isotopologs H 13 CN and HC 15 N in the disk orbiting the 8 Myr old TTauri star TW Hya. The sensitivity allows directly measuring the HCN/H 13 CN and HCN/HC 15 N abundance ratios with minimal assumptions. Averaged spatially over the disks, the ratios are 86±4 and 223±21, respectively. The latter value is significantly lower than the CN/C 15 N ratio of 323±30 in this disk and thus provides the first evidence that two isotopic reservoirs of nitrogen are present in a disk at the stage of giant planet and comet formation. Furthermore, we find clear evidence for an increase in the ratio of HCN to HC 15 N with radius. The ratio in the outer disk, at 45 au, is 339±28, in excellent agreement with direct measurements in the local interstellar medium, and with the bulk nitrogen isotopic ratio predicted from galactic evolution calculations. In the comet formation region at r = 20 au, the ratio is a factor ≈ 3 lower, 121±11. This radial increase qualitatively agrees with the scenario in which selective photodissociation of N 2 is the dominant fractionation process. However, our isotopic ratios and kinetic temperature of the HCN-emitting layers quantitatively disagree with models of nitrogen chemistry in disks.