The speed of the laser scanned by the scanning means such as a galvanometer mirror or a polygon mirror is not constant in the center portion and in the end portion of the scanning width. As a result, the object, for example an amorphous semiconductor film, is irradiated with the excessive energy and therefore there is a risk that the amorphous semiconductor film is peeled. In the present invention, in the case where the laser spot of the energy beam output continuously on the irradiated object is scanned by moving it back and forth with the use of the scanning means or the like, the beam is irradiated to the outside of the element-forming region when the scanning speed of the spot is not the predetermined value, for example when the speed is not constant, and accelerates, decelerates, or is zero, for example in the positions where the scanning direction changes, or where the scanning starts or ends.