Both states ranked near the top of the best school systems in the nation.

Maryland and Virginia have some of the best public schools in the country according to a new study by Wallet Hub. Both states ranked in the top 10 of a study that determined the best and worst school systems in the U.S. Wallet Hub analysts ranked the school systems based on two key categories, quality and safety. Those categories included test scores, teacher to students ratios, graduation rates, and incidents of bullying.

Virginia was ranked at No. 4 and Maryland came in at No. 6. The District of Columbia came in at No. 37. Most of the studies that rank schools concentrate on graduation rates and college enrollment rates but the Wallet Hub study incorporated safety aspects like bullying, the presence of guns in school, and access to learning materials outside of the school campus. The information was drawn from a variety of sources including the U.S. Department of Education, Centers for Disease Control and Prevention, College Boards, and the Office of Juvenile Justice and Delinquency Prevention.

The state with the highest median ACT scores, highest median reading test scores, and highest median math test scores is the state that came in No. 1 overall, Massachusetts. Virginia also ranked near the top for the highest median math scores. Maryland scored points for spending per pupil and having a strong school system along with Virginia.

The school system that came in at the bottom of the list was New Mexico. The District of Columbia had low median test scores in math, reading, and on the SAT, but did have the lowest incidence of bullying in the U.S. The state with the lowest dropout rate was Alabama, the state with the highest percentage of dropouts was D.C. To see how all the states ranked, view the complete study at the Wallet Hub website.

Do you agree with these rankings? Tell us what you love about your schools? Share your thoughts in the comments.