EL SEGUNDO, Calif. — Toy maker Mattel says weak sales of Barbie and markdowns to clear out excess inventory left over from a sluggish holiday season led to an unexpected first-quarter loss.

Its shares fell almost 5 percent in premarket trading.

Toy makers are facing a weak environment globally due to the uncertain economy and popularity of electronic gadgets. The first quarter is the seasonally smallest for toy makers, coming after the key holiday quarter which can account for up to 40 percent of revenue.

In addition, Mattel Inc. has been struggling with weakness in core brands like Barbie, which had a 14 percent drop in sales, and Fisher-Price, down 6 percent.

“Revenues were consistent with our expectations as we worked through inventories in a challenging global retail environment,” said CEO Bryan G. Stockton.

The largest U.S. toy maker says its net loss for the three months ended March 31 totaled $11.2 million, or 3 cents per share. That compares with net income of $38.5 million, or 11 cents per share last year. Analysts expected earnings of 7 cents per share.

The company which makes Disney Princess dolls and Hot Wheels cars says revenue fell 5 percent to $946.2 million from $995.6 million. Analysts expected $947.6 million. Revenue fell 2 percent in North America and 7 percent internationally.

Separately the company declared a second-quarter dividend of 38 cents, payable on June 13 to shareholders of record on May 23.

Its shares dropped $1.81, or 4.8 percent, to $36.07 in premarket trading about two hours before the market opening.