We show that the linking of a semiclassical path of a charged particle with a knotted magnetic solenoid results in the Aharonov–Bohm effect. The phase shift in the wave function is proportional to the flux intersecting a certain connected and orientable surface bounded by the knot (a Seifert surface of the knot).