The Supreme Court can be seen from the view from near the top of the Capitol Dome on Capitol Hill, Thursday, Dec. 19, 2013, in Washington. (AP Photo/Susan Walsh)

WASHINGTON (AP) — The Supreme Court has ruled that police may search a home without a warrant when two occupants disagree about allowing officers to enter, and the resident who refuses access is then arrested.

The justices on Tuesday declined to extend an earlier ruling denying entry to police when the occupants disagree and both are present.

Justice Samuel Alito wrote the court’s 6-3 decision holding that an occupant may not object to a search when he is not at home.

Police found a shotgun, ammunition and a knife when they searched the Los Angeles apartment that Walter Fernandez shared with his girlfriend.

Fernandez told police they could not enter. But shortly after his arrest, officers returned to the apartment and persuaded the girlfriend to let them in.