This invention is intended to enhance and improve the resistance of a single- or double-stranded nucleic acid fragment comprising a base sequence of a functional nucleic acid to degradation by nucleolytic enzymes in a simple and cost-effective manner. The single- or double-stranded nucleic acid fragment comprises, ligated to at least one 3 end thereof, a hairpin-shaped DNA comprising: (A) a nucleic acid region consisting of 2 to 5 arbitrary nucleotides (B) a nucleic acid region consisting of a "gna" or "gnna" base sequence, wherein each "n" represents "g", "t", "a", or "c", a base analogue, or a modified base and (C) a nucleic acid region consisting of a base sequence complementary to the nucleic acid region (A), sequentially ligated from the 5 end toward the 3 end, wherein at least one of two 3 terminal nucleotides from at least one 3 end of the single-stranded nucleic acid fragment or the double-stranded nucleic acid fragment is modified.