It is shown theoretically that the confinement of an electron at a repulsive potential can exist in nanostructures subjected to a strong high-frequency electromagnetic field. As a result of the confinement, the metastable bound electron state of the repulsive potential appears. This effect can lead, particularly, to electron pairing in nanostructures containing conduction electrons with different effective masses.