MIAMI — A judge in the second-degree murder case against George Zimmerman, the Sanford, Fla., man who said he shot an unarmed teenager, Trayvon Martin, in self-defense, ruled on Friday that Mr. Martin’s school and social media records should be provided to the defense.

The judge, Debra S. Nelson of Seminole County Circuit Court, said Mr. Martin’s Twitter, Facebook and school records were relevant in the self-defense case.

In those instances, showing whether a victim “had an alleged propensity to violence” or aggression is germane, the judge said.

Mr. Zimmerman, 29, who attended the hearing, told the police that he shot Mr. Martin on the night of Feb. 26 only after the teenager attacked him, breaking his nose and hurting his head.