We present a proposal on how to develop nonmonotonic reasoning based on the modal logic S4. As a consequence of our results we show how to present the well known semantics of answer sets, under a restricted fragment of modal formulas, using this approach. Moreover, by considering the full set of modal formulas we obtain an interesting generalization of answer sets with modal connectives. We show, with several examples, possible applications of this proposed inference system and how the syntax of modal formulas can clearly describe notions such as negation as failure. It is also possible to replace the modal logic S4 with any other modal logic to obtain similar nonmonotonic systems. We even consider the use of multimodal logics in order to model a scenario where several agents can reason about the knowledge and beliefs of each other. Our results clearly state interesting links between answer set programming, modal logics and multi-agent systems which might bring research of these areas together.