Before that 2003 ruling, 27 states, the District of Columbia, and 4 territories had repealed their sodomy laws by legislative action, 9 states had had them overturned or invalidated by state court action, 4 states still had same-sex sodomy laws, and 10 states, Puerto Rico, and the U.S. military had laws applying to all regardless of gender. In 2005 Puerto Rico repealed its sodomy law, and in 2006 Missouri repealed its law against "homosexual conduct". In 2013, Montana removed "sexual contact or sexual intercourse between two persons of the same sex" from its definition of deviate sexual conduct, Virginia repealed its lewd and lascivious cohabitation statute, and sodomy was legalized in the US armed forces.