Restriction endonucleases catalyse DNA cleavage at specific sites. The BfiI endonuclease cuts DNA to give staggered ends with 1-nt 3'-extensions. We show here that BfiI can also fill in the staggered ends: while cleaving DNA, it can add a 2'-deoxynucleoside to the reaction product to yield directly a blunt-ended DNA. We propose that nucleoside incorporation proceeds through a two-step reaction, in which BfiI first cleaves the DNA to make a covalent enzyme-DNA intermediate and then resolves it by a nucleophilic attack of the 3'-hydroxyl group of the incoming nucleoside, to yield a transesterification product. We demonstrate that base pairing of the incoming nucleoside with the protruding DNA end serves as a template for the incorporation and governs the yield of the elongated product. The efficiency of the template-directed process has been exploited by using BfiI for the site-specific modification of DNA 5'-termini with an amino group using a 5'-amino-5'-deoxythymidine.