This is an example of what is called a disjunctive adverb. It doesn't really fit anywhere in the flow of a sentence and is more a kind of evaluation of the rest of the sentence. We can say that it modifies the entire sentence. Other examples are fortunately, unfortunately, luckily.One of the most common is hopefully.