BALTIMORE — Eight months after the Justice Department announced new curbs on racial profiling, Maryland became on Tuesday the first state to follow suit, with guidelines aimed at severely restricting law enforcement officers from singling out suspects based on traits including race, ethnicity and sexual orientation.

Attorney General Brian E. Frosh of Maryland issued the rules in a nine-page memorandum in which he condemned profiling of racial minorities by the police, calling it a “deeply unfair” practice.

“Racial profiling continues despite the fact that it is against the law of the United States; it’s against Maryland law,” Mr. Frosh said in a telephone interview shortly after announcing the guidelines at a news conference in the state capital, Annapolis. “We need people to understand that racial profiling is illegal, and it’s bad police work.”

Maryland law requires law enforcement agencies to have policies prohibiting racial and ethnic profiling during traffic stops; the new guidelines expand on that in two ways, Mr. Frosh’s office said. Under the law, officers may not use race and ethnicity in making police decisions; the guidelines also include national origin, identity, disability and religion as traits that may not be considered. They apply to routine operations, to investigations and to traffic stops.