A University of Maryland graduate student opened fire on his two housemates in an off-campus residence then turned the gun on himself, Prince George's County Police said.
Police identified the suspected shooter as Dayvon Maurice Green and said he had purchased the gun legally about one year ago. Police said Green had been suffering from an unspecified mental illness before the shooting.
Green was studying computer science at the University of Maryland and had completed an undergraduate degree at Morgan State University.
Police said that shortly after 1 a.m. Tuesday, he set a fire in the basement of his rented home. As his two housemates ran outside and confronted him, he opened fire, according to authorities.
Green then went to the rear of the house and killed himself, police said.
One housemate, who sustained non-life-threatening injuries, ran to a neighbor's house for help. The other victim later died at a local hospital.
"All I heard was about six to seven shots going, 'pop pop pop,' and then about 15 minutes later, we saw the cops," neighbor Jithin George told NBC's Washington TV station News4.
The identities of the victims -- both male University of Maryland students -- have not yet been released. It is unknown whether they were graduate or undergraduate students.
The university sent an alert to students around 1:15 a.m., warning them that a shooting had been reported off-campus.