### Entanglement generation and single atom state readout schemes

The atom–photon entanglement generation process is visualized in Extended Data Fig. 1a. It starts by preparing the atom in the state \({5}^{2}{S}_{1/2}|F=1,{m}_{F}=0\rangle \) by optical pumping with an efficiency of 80%. Next, a short laser pulse with 21 ns full-width at half-maximum excites the atom to the state \({5}^{2}{P}_{3/2}|{F}^{{\prime} }=0,{m}_{{F}^{{\prime} }}=0\rangle \). In the subsequent spontaneous decay, the atomic spin state becomes entangled with the polarization state of the emitted photon, denoted as \({|\Psi \rangle }_{AP}=1/\sqrt{2}({|\downarrow \rangle }_{z}|L\rangle +{|\uparrow \rangle }_{z}|R\rangle )=1/\sqrt{2}({|\downarrow \rangle }_{x}|H\rangle +\,{|\uparrow \rangle }_{x}|V\rangle )\), where \(|H\rangle =\) \(i/\sqrt{2}(|L\rangle -|R\rangle )\), \(|V\rangle =1/\sqrt{2}(|L\rangle +|R\rangle )\), \({|\downarrow \rangle }_{x}=i/\sqrt{2}({|\uparrow \rangle }_{z}-{|\downarrow \rangle }_{z})\), and \({|\uparrow \rangle }_{x}=\)\(1/\sqrt{2}({|\uparrow \rangle }_{z}+{|\downarrow \rangle }_{z})\).

The atomic state readout process is visualized in Extended Data Fig. 1b. After a successful atom–atom entanglement generation event, the atomic spin states of the atoms are individually analysed using a state-selective ionization scheme. This scheme starts by transferring a selected atomic qubit state superposition from the ground state \({5}^{2}{S}_{1/2}|F=1\rangle \) to the excited state \({5}^{2}{P}_{1/2}|{F}^{{\prime} }=1\rangle \) with light at 795 nm (‘readout light’). Simultaneously, the excited state is ionized using a bright laser pulse at 473 nm. If the atom possibly decays to the state \({5}^{2}{S}_{1/2}|F=2\rangle \) before ionization, as indicated with the right-most grey arrow in Extended Data Fig. 1b, a 780-nm cycling pulse will transfer it to the state \({5}^{2}{P}_{3/2}|{F}^{{\prime} }=3\rangle \), which is also ionized. The state readout is completed by fluorescence collection on a closed atomic transition to check whether the atom is still present in the trap or not. The fidelity of atomic state readout operation is 96%.

The measurement basis of the atomic qubit state is controlled by the polarization of the readout light pulse, which is defined as \(\chi =\,\cos (\alpha )V+{e}^{-i\varphi }\,\sin (\alpha )H\). Accordingly, two orthogonal atomic qubit state superpositions can be derived of which one is transferred to the excited state by the readout pulse (bright-state) and the other is not (dark state), given as

$${|\Psi \rangle }_{{\rm{Bright}}-{\rm{State}}}=\,\cos (\alpha )\frac{1}{\sqrt{2}}({|\downarrow \rangle }_{z}-{\uparrow \rangle }_{z})+\,\sin (\alpha ){e}^{-i\varphi }\frac{i}{\sqrt{2}}({|\downarrow \rangle }_{z}+{\uparrow \rangle }_{z})$$

(2)

$${|\Psi \rangle }_{{\rm{Dark}}-{\rm{State}}}=\,\sin (\alpha )\frac{1}{\sqrt{2}}({|\downarrow \rangle }_{z}-{\uparrow \rangle }_{z})-\,\cos (\alpha ){e}^{-i\varphi }\frac{i}{\sqrt{2}}({|\downarrow \rangle }_{z}+{\uparrow \rangle }_{z})$$

(3)

Note that all states except the dark state are excited and hence ionized, for example, population in the state \({5}^{2}{S}_{1/2}|F=1,{m}_{F}=0\rangle \)is always ionized. This makes the readout scheme a projection measurement onto the dark state.

An intuitive example of the state selectivity is the case of a *σ*^{+}-polarized readout pulse. In the *z* basis, as shown in Extended Data Fig. 1b, this pulse will excite an atom in the state \({|\downarrow \rangle }_{z}\) to the state \({5}^{2}{P}_{1/2}|{F}^{{\prime} }=1,{m}_{{F}^{{\prime} }}=0\rangle \), however, an atom in the state \({|\uparrow \rangle }_{z}\) will not be excited because of the absence of the state \({5}^{2}{P}_{1/2}|{F}^{{\prime} }=1,{m}_{{F}^{{\prime} }}=2\rangle \).

### Atom–photon entanglement distribution at telecom wavelength

The polarization-preserving QFC devices used in this work are described in detail in refs. ^{9}^{,}^{41}. In contrast to previous work, here a more favourable pump-signal frequency combination is selected with respect to the Raman background: 1,607–1,517 nm instead of 1,600–1,522 nm. This increases the SBR by a factor of four and allows to install a QFC device in both nodes without being limited by the SBR.

Because the quality of the entanglement shared between the two nodes directly depends on the fidelity of the two entangled atom–photon pairs, we individually characterize the atom–photon entanglement generated in both nodes. The generated states are analysed using the same fibre configurations and atomic readout times as during the atom–atom entanglement measurements presented in the main text. For an overview, see Extended Data Table 1. Note that a high fidelity atomic state readout can only be made after a full oscillation period of the atom in the dipole trap, which equals 14.3 and 17.8 μs for nodes 1 and 2, respectively.

The atom–photon entanglement fidelity is analysed following the methods in ref. ^{9}, in which the atomic readout time is now delayed to allow for two-way communication to the middle station for each node over the respective fibre length. The polarization of the photons are measured in two bases, *H*/*V* (horizontal/vertical) and *D*/*A* (diagonal/antidiagonal), that is, *X* and *Y*, whereas the atomic analysis angle was rotated over angles including these bases. The atom–photon state correlations are shown for node 1 in Extended Data Fig. 2 and for node 2 in Extended Data Fig. 3.

For the fibre configuration *L* = 6 km, that is, *L*_{1} = 2.6 km and *L*_{2} = 3.3 km, we find atom–photon state fidelities of 0.941(5) for node 1 and 0.911(6) for node 2, relative to a maximally entangled state, which are mainly limited by the atomic state readout and entanglement generation fidelity. For longer fibre lengths, the fidelity of the entangled state reduces due to magnetic field fluctuations along the bias field direction and the position-dependent dephasing.

### Modelling of the quantum memory decoherence

In both nodes, a single ^{87}Rb atom is stored in an optical dipole trap where a qubit is encoded into the states \({5}^{2}{S}_{1/2}|F=1,{m}_{F}=\pm 1\rangle \). The dipole trap is operated at \({\lambda }_{{\rm{ODT}}}=850\) nm with typical trap parameters of, for example, for node 1, a trap depth *U*_{0} = 2.32 mK and beam waist *ω*_{0} = 2.05 μm. The qubit evolves effectively in a spin-1 system as the state \({5}^{2}{S}_{1/2}|F=1,{m}_{F}=0\rangle \) could also be populated. The state fidelity is influenced by two factors: the first one is the a.c. Stark shift originating from the dipole trap and, second, the Zeeman effect arising from magnetic fields.

To model the dephasing of the quantum memories, we simulate the evolution of this spin-1 system while the atom is oscillating in the dipole trap, affected by longitudinal polarization components and external magnetic fields^{42}. For this, we first randomly draw a starting position and velocity of an atom from a 3D harmonic oscillator distribution in thermal equilibrium. Second, the motion of the atom is simulated in a realistic Gaussian potential resulting in an atomic trajectory for which the evolution of the atomic state is calculated on the basis of the local optically induced and external magnetic fields. Finally, this is repeated for a large number of trajectories in which the averaged projection for all trajectories yields the simulation result.

The model takes the following independently measured inputs: (1) the trap geometry specified by the beam waist *ω*_{0}, which is obtained from knife-edge measurements of the dipole trap beam focus in two dimensions^{43}; (2) the trap depth *U*_{0}, determined by measurements of the transverse trap frequency using parametric heating^{44} and the atomic state rephasing period^{42} and (3) the atomic temperature *T*, modelled as a Boltzmann distribution that is measured by the release and recapture technique^{45}. Inputs 1 and 2 define the position, amplitude and phase of the longitudinal polarization components, whereas inputs 1–3 characterize the atomic trajectories. Furthermore, we include a uniform magnetic field along three directions with shot-to-shot noise following Gaussian distributions.

Extended Data Fig. 4 shows simulation results and measurement data of the state evolution in node 1 for varying state readout orientation and time. The model accurately predicts the evolution of the measured atomic states and shows that the memory storage time is limited by magnetic field fluctuations on the order of <0.5 mG along the bias field direction in addition to the position-dependent dephasing due to the longitudinal field components of the strongly focussed dipole trap. The simulation results presented in the main text consider the envelope of the found oscillating state evolution in three bases.

### Experimental sequence

The entanglement generation sequence is visualized in Extended Data Fig. 5. The sequence starts by trapping an atom in both nodes. For this, a single atom is loaded from a magneto-optical trap into a tightly focussed dipole trap, which takes roughly 1 s (2 s) for node 1 (2). Every entanglement generation try consist of 3 μs optical pumping (80% efficiency) and an excitation pulse (Gaussian laser pulse with a full-width at half-maximum of 21 ns) to generate atom–photon entanglement in the following decay. Subsequent to each try, a waiting time is implemented to cover the propagation time of the photons in the long fibres. After 40 unsuccessful tries, the atoms are cooled for 350 μs using polarization gradient cooling. The lifetime of the atoms in the trap during the entanglement generation process is 4 s (6 s) for node 1 (2).

To verify whether both traps still store a single atom during the entanglement generation tries, the process is interrupted after 200 ms to check the presence of the atoms. For this, a microelectromechanical systems, a fibre-optic switch is installed in each node at the SM-fibre that is used for the atomic fluorescence collection from the atom trap. The switches guide the atomic fluorescence either to the QFC devices during the entanglement generation tries, or to an avalanche photodiode located at each node during 40 ms of fluorescence collection. Note that the SNSPDs of the BSM cannot be used for this purpose because they are behind narrowband spectral filters.

Regular maintenance tasks lower the duty cycle of the experiment to roughly half for all link lengths. This includes the fraction of time required to simultaneously load an atom in the traps (0.40(5)), the fraction of time used to verify if both traps still store a single atom during the entanglement generation tries (0.18), and the fraction of time used to compensate polarization drifts of the long fibres (0.05).

### Entanglement generation rate

The atom–atom entanglement generation rate *r* is given by

here *η* equals the success probability for each entanglement generation try and *R* is the repetition rate of the entanglement generation tries. Both *η* and *R* are dependent on the link length *L*. In the following, we assume a two-node setup with a middle station halfway the nodes, that is, *L* = *L*_{1} + *L*_{2} with *L*_{1} = *L*_{2}, where *L*_{1} (*L*_{2}) equals the link length from node 1 (node 2) to the middle station.

The success probability of an entanglement generation try is given by

$$\eta (L)={\eta }_{L=0}{10}^{-\alpha /10L}={\mathscr{O}}(exp(-L)),$$

(5)

here *η*_{L=0} denotes the success probability for a setup with a zero length link and approximates 5.0 × 10^{−6} for the presented apparatus. This includes the photon collection efficiencies in both nodes after an excitation attempt (1.0 and 1.1%), the transmission of the microelectromechanical system switches (85%*), the efficiency of the frequency conversion devices (57%*), the single-photon transmission efficiencies of the spectral filtering cavities (81%*), the fibre coupling to the single-photon detectors (90%*), the single-photon detector efficiencies (85%*) and the fraction of distinguishable Bell states of 2/4 (*these efficiencies should be included twice). The attenuation rate in optical fibres is denoted by *α* in units of dB km^{−1}, which is reduced using polarization-preserving QFC to telecom wavelength from 4.0 dB km^{−1} at 780 nm to 0.2 dB km^{−1} at 1,517 nm.

The repetition rate of the entanglement generation tries equals

$$R(L)=\frac{1}{T}=\frac{1}{{T}_{L=0}+\frac{1}{2}L/\left(\frac{2}{3}c\right)}={\mathscr{O}}({L}^{-1}),$$

(6)

where *T* is the period of an entanglement generation try. The period of an entanglement generation try for a link with *L* = 0 is denoted by *T*_{L=0} and equals 12 μs for the presented apparatus (*R*(0) = 8.3 × 10^{4} s^{−1}). This includes the initial state preparation (3 μs), the entanglement generation (200 ns), and the duration of the polarization gradient cooling per try (350 μs/40) to counteract the introduced heating during the state preparation and entanglement generation tries. The second term in the denominator gives the communication times between the nodes and the middle station over optical fibres, where \(\frac{2}{3}c\) approximates the speed of light in an optical fibre. The factor \(\frac{1}{2}\) appears as, in the implemented experimental sequences, the electronic delay for the atomic readout is only applied after a successful heralding event (Methods, Experimental sequence). This is not feasible when the two nodes are physically separated by a distance *L* and, effectively, reduces the entanglement generation rate by a factor up to two for a physical separation *L* compared to the values observed in this work.

For *L* < 54 km the entanglement generation rate is mainly reduced by the rapidly decreasing repetition rate *R*, for example, from *L* = 0 to *L* = 33 km, *R*(*L*) drops by a factor of 8 while the success probability reduces by a factor 4.5. Only for distances *L* > 54 km will the exponential dependence of the success probability outweigh the dependence of the repetition rate. Extended Data Fig. 6 shows the expected entanglement generation rate according to equations (4)–(6) extrapolated to distances up to 100 km, together with the entanglement generation rate of the data presented in the main text.

Note that the fidelities presented in the main text equal the expected fidelities for a physical separation of the nodes by a distance *L*. Moreover, the measurement times reported in the main text include a duty cycle of the experiment of roughly half, for example, the time effectively used for the entanglement generation tries approximates half of the reported measurement times (Methods, Experimental sequence).

### Atom–atom state fidelity

The state of the atomic quantum memories is encoded in two magnetic sublevels of the rubidium ground state \({5}^{2}{S}_{1/2}|F=1\rangle \), which, however, is a spin-1 system. Besides the qubit states \(|{m}_{F}=\pm 1\rangle \), also the state \(|{m}_{F}=0\rangle \) can be populated, because of, for example, magnetic fields in a direction not coinciding with the quantization axis. Hence, the atom–atom state effectively occupies a 3 × 3 state space. Assuming isotropic dephasing towards white noise, the fidelity relative to a maximally entangled state is therefore estimated as \({\rm{ {\mathcal F} }}\ge 1/9+8/9\bar{V}\), where \(\bar{V}\) is average visibility in three orthogonal bases. The commonly used fidelity estimation from visibilities for an entangled two-qubit system is \( {\mathcal F} \ge 1/4+3/4\bar{V}\). For the effective two-qutrit system, however, this would result in an higher fidelity and would overestimate the fidelity of the generated atom–atom state.

### Polarization control of long fibres

Stress or temperature induced polarization drifts in the long fibres are compensated using an automated polarization control. The polarization control is performed every 7 min, takes on average 20 s, and is based on a gradient descent optimization algorithm. In this way, polarization errors are kept below 1% during all measurements.

The fibre polarization is optimized using laser light at the single-photon frequency with sufficient optical power to be detected by conventional photodiodes. Two polarization directions are used, vertical and diagonal linear polarizations, which are alternated at 10 Hz. The light is overlapped at the nodes with the complete single-photon path up to the detectors. In both output arms of the beamsplitter, a flip-mirror reflects the classical light into a polarimeter during the optimization. Three fibre polarization controllers are connected to the fibre beamsplitter of the BSM: at both input ports and at one output port, and are set according to the result of the gradient descent optimization algorithm.

Polarization drifts in the long fibres are compensated in our setup, which includes a 700 metre fibre crossing public space and a four lane street. Recently, polarization drifts over a 10 km field deployed fibre were characterized and compensated^{46}. In our setup with a configuration of 32.4 km spooled and 0.7 km field fibre, we observe similar drifts. This indicates that a setup including longer field deployed fibres does not introduce substantially more drifts than observed now and that the currently used system can compensate for polarization drifts in longer field deployed fibres.

### Entanglement swapping fidelity

The single photons are detected with a BSM device consisting of a fibre beamsplitter, two polarizing beamsplitters (Wollaston Prisms) and four SNSPDs, as illustrated in Fig. 1 of the main text. In this setup, the fibre beamsplitter guarantees a unity spatial overlap of the photons originating from the nodes, whereas the polarizing beamsplitters and single-photon detectors allow for polarization analysis in both output ports. The detectors, labelled H_{1}, V_{1}, H_{2} and V_{2}, are not photon number resolving, and hence we only distinguish between six coincidence combinations of two detectors, see Extended Data Table 2. For the purpose of a BSM, we can categorize these combinations into three groups: *D*_{+}, *D*_{−}, and *D*_{∅}. Here, detector combinations in group *D*_{+} and *D*_{−} herald the Bell states \(|{\Psi }^{+}\rangle \) and \(|{\Psi }^{-}\rangle \), respectively, whereas combinations in group *D*_{∅} should not occur for perfectly interfering photons and are discarded in the analysis. However, the relative occurrence of these events is used in the following to quantify the two-photon interference contrast.

For not interfering photons, two-photon events are evenly distributed between the 16 possible detector combinations (not considering experimental imperfections). As the order of the detector combination is not of interest, for example, (V_{1},H_{1}) is similar to (H_{1},V_{1}), we end up with ten distinct coincidences and their probabilities, as listed in Extended Data Table 1. For perfectly interfering photons, the probabilities differ: the probability to detect the *D*_{∅} group vanishes and all four Bell states are detected with a probability of 1/4, whereby the \(|{\Phi }^{\pm }\rangle \) Bell states fall into the group ‘not detected’ for the setup used.

The two-photon interference contrast is defined as^{10}

$$C=1-\frac{2{N}_{{D}_{\varnothing }}}{{N}_{{D}_{+}}+{N}_{{D}_{-}}},$$

(7)

where *N*_{k} is the number of events in detection group *k*. With this definition and the probabilities of the different coincidences, the contrast equals zero for not interfering photons and one for perfectly interfering photons. See ref. ^{34} for a thorough analysis of the two-photon interference contrast and entanglement swapping fidelity, including experimental imperfections.

The interference contrast is measured as follows. During measurement runs all single-photon detection events are recorded, which allows to count the number of occurrences of the coincidence events for all three detection groups. Next, the interference contrast is evaluated using equation (7). To verify this method, we additionally evaluate the contrast of not interfering photons. This is done by analysing coincidence detections of two photons originating from distinct entanglement generation tries. In this way, the photons did not interfere because the photon wave-packets are completely separated in time. Fig. 2b of the main text shows exactly this for the *L* = 6 km measurement. Shown are the normalized wrong coincidences, defined as 1−*C*, for varying time differences between the photons (Δ*τ*). Note that the horizontal spacing of the measurement times equals the repetition rate of the entanglement generation tries.

The entanglement swapping fidelity is mainly limited by two effects. First, it is limited by experimental imperfections that reduce the indistinguishability of the two photons, for example, as discussed in the main text, by an imperfect time overlap of the two photon wave-packets. Second, it is limited by double excitations stemming from the finite duration of the excitation pulse. For a detailed description, see refs. ^{13,34}.