While the infection involves a number of bacteria, it is believed that most infections start with Gardnerella vaginalis  creating a biofilm, which allows other opportunistic bacteria to thrive.One of the main risks for developing BV is douching, which alters the vaginal microbiota and predisposes women to developing BV. Douching is strongly discouraged by the U.S. Department of Health and Human Services and various medical authorities, for this and other reasons.BV is a risk factor for pelvic inflammatory disease, HIV, sexually transmitted infections (STIs), and reproductive and obstetric disorders or negative outcomes. Although BV can be associated with sexual activity, there is no clear evidence of sexual transmission. It is possible for sexually inactive persons to develop bacterial vaginosis.Also, subclinical iron deficiency may correlate with bacterial vaginosis in early pregnancy. A longitudinal study published in February 2006, in the American Journal of Obstetrics and Gynecology, showed a link between psychosocial stress and bacterial vaginosis persisted even when other risk factors were taken into account. Exposure to the spermicide nonoxynol-9 does not affect the risk of developing bacterial vaginosis. Diagnosis
To make a diagnosis of bacterial vaginosis, a swab from inside the vagina should be obtained. These swabs can be tested for:

Gram stain which shows the depletion of lactobacilli and overgrowth of Gardnerella vaginalis  bacteria. Bacterial vaginosis is usually confirmed by  a Gram stain of vaginal secretions. A characteristic "fishy" odor on wet mount.
This test, called the whiff test, is performed by adding a small amount of potassium hydroxide to a microscope slide containing the vaginal discharge. A characteristic fishy odor is considered a positive whiff test and is suggestive of bacterial vaginosis. Loss of acidity. To control bacterial growth, the vagina is normally slightly acidic with a pH of 3.8–4.2. A swab of the discharge is put onto litmus paper to check its acidity. A pH greater than 4.5 is considered alkaline and is suggestive of bacterial vaginosis. The presence of clue cells on wet mount. Similar to the whiff test, the test for clue cells is performed by placing a drop of sodium chloride solution on a slide containing vaginal discharge. If present, clue cells can be visualized under a microscope. They are so-named because they give a clue to the reason behind the discharge. These are epithelial cells that are coated with bacteria.Differential diagnosis for bacterial vaginosis includes the following:
Normal vaginal discharge. Candidiasis (thrush, or a yeast infection). Trichomoniasis, an infection caused by Trichomonas vaginalis. Aerobic vaginitisThe Center for Disease Control (CDC) defines STIs as "a variety of clinical syndromes and infections caused by pathogens that can be acquired and transmitted through sexual activity." But the CDC does not specifically identify BV as sexually transmitted infection.