For a long time, .edu was restricted to four-year degree-granting institutions, which represented a reduction from its former status open to anything educational. Some non-qualifying sites still had .edu domains because they were grandfathered in from before this restriction was imposed.
However, once .edu came under new management (a consortium named EduCause), they eased the restrictions to allow community colleges to get .edu addresses. Previously, they were stuck under .us, as are both public and private primary and secondary schools in the United States (except for those which go and improperly get .com or .org domains instead...) Other categories of accredited educational institutions have gradually been added to the .edu-eligible group too, but so far only in the United States (though it would really make more sense for US-specific domains to be within the .us country code).