Servo and PWM control of LEDs

I have the following program (below) that behaves in a way that I don’t understand. The first time through the loop, the LED behaves as expected. For the second iteration, it flashes for a brief moment, and after that it never lights again. If I remove the servo code, the LED flashes and works as expected. If I put the servo code back in, but substitute digitalWrite for the analogWrite for the LED, all works fine.

So it looks like there is some interaction with PWM and the servo library. Is there anything I can do to “fix” the problem or is this considered an “illegal” operation?

Thanks in advance.

#include <Servo.h>

#define LED_PIN   10
#define SERVO_PIN  5

// create a servo instance
Servo servo ;

void setup() {
  // I tried adding this line and but it does not affect 
  // behavior of the loop
   //pinMode(LEDPIN, OUTPUT) ;
  // put your setup code here, to run once:

void loop() {

  // light up and extinguish the LED
  // put a delay in so we can see it
   pinMode(LED_PIN, OUTPUT) ;
   analogWrite(LED_PIN, 250) ;
   delay(500) ;
   analogWrite(LED_PIN, 0) ;
   delay(500) ;

   // play with servo
   servo.attach(SERVO_PIN, 1000, 2000) ;
   delay(100) ;
   servo.write(0) ;
   delay(1000) ;
   servo.write(90) ;
   delay(1000) ;


Pay particular attention to the second paragraph.

Is there anything I can do to "fix" the problem

Move the PWM output to a pin other than 3 or 10 or use a servo library that does not user timer1, such as ServoTimer2.

sp. "9 or 10"

Whoops. Your are right, of course. I don't know which brain cell the 3 came from but it is obviously defective. I can't even blame my bad touch typing.

Thanks guys, that it explains it. I thought I read the documentation, but apparently not. Sorry about the noob question. :D