PORTLAND, Maine (AP) _ A school crossing guard who allegedly shot twice at a student was charged with attempted murder and ordered to undergo psychiatric tests, police said. The student was unharmed.

James F. Murphy, 40, shot at Clinton Drake III, 14, from about six feet away on Friday but missed, then fired again but his .25-caliber semiautomatic pistol jammed, police said.

''He was laughing and shaking,'' Drake said. ''He was laughing like he was happy. I was thinking, 'Is he going to kill me or is he fooling with me?

''Then he pointed the gun at my chest and fired and missed,'' Drake said. ''I saw the smoke and the shell pop out the side. Then he pulled the trigger again.''

Police said they recovered a pistol and 50 rounds of ammunition when they arrested Murphy in a convenience store parking lot shortly after the incident.

Police Chief Michael Chitwood said police were investigating a possible racial motive. Drake, a student in the Portland Rehabilitation Education Program, is black. Murphy is white.

Drake said that on Thursday, Murphy yelled a racial insult at him. When Drake met Murphy again Friday, Drake told him to avoid racial slurs.

Murphy was arraigned in Superior Court on an attempted murder charge and ordered held in jail pending psychiatric evaluation.