Modality in its broadest sense refers to the mode in which a certain truth is true. Necessity and possibility are called logical modalities. A necessary truth is a truth that could not fail to be true. Truths of mathematics are examples of necessary truths. A possible truth is not necessarily false. Contingent truths are those which are true but not necessarily true. (Note that there is a difference between contingent and possible truths: necessary truths are also possible since they are not necessarily false; but yet they are not contingent).
One way philosophers have classified truths is epistemic, namely - by the way we get to know things:
a. Leibniz made a distinction between truths of reason and truths of fact; for those of the former he says the explanation of their truth can be found by analysis alone (Leibniz 1714: §33).
b. Hume distinguished among the objects of enquiry between relations of ideas and matters of fact; propositions of the first kind are discoverable by mere thought without dependence on what is anywhere existent in the universe and they are intuitively or demonstratively certain; propositions of the second kind are justified by the present testimony of the senses, memory and reasoning involving cause and effect (Hume 1748; §IV part i).
c. Kant provided the terminology mostly used today for distinguishing truths epistemologically: a priori truths can be known or justified independently of experience, a posteriori truths are known or justified on the basis of experience.
These philosophers shared disagreement about the details of this classification. Yet they agreed that the epistemic status of truths is intrinsically linked with their modal status. Thus, the existence of necessary truths which are known by thinking or reason alone has been acknowledged by philosophers in both the empiricist and rationalist (or intellectualist) schools of thought. Some empiricists however felt uneasy about this - after all, the basic tenet of empiricism is that all ideas and knowledge derive from experience. This was the case with logical positivism.