FOXBOROUGH — Devin McCourty made several costly mistakes at cornerback. At safety, the New England Patriots lost both starters to injury.

So they shifted McCourty to safety and, suddenly, the Patriots prospects at both positions look brighter.

A Pro Bowl player as a rookie in 2010, McCourty’s athleticism and knowledge of the defense have made the transition easier to a position he played his first two seasons at Rutgers.

“Dev’s a great athlete,” safety Steve Gregory said. “He’s a smart football player. He understands what we’re trying to do as a defense and he has the ability to play any position in the secondary, so he’s done a great job.”

He wasn’t doing so great at cornerback this year.

Several times he didn’t turn to face the ball when a receiver went up for it. He was called for pass interference penalties — one that led to the winning field goal on the final play of a 31-30 loss to the Baltimore Ravens.

But Gregory has missed the last four games with an injured hip and the other starting safety, Patrick Chung, has been sidelined two games with a shoulder injury. Both practiced on a limited basis this week and could be ready when the Patriots (5-3) play the Buffalo Bills (3-5) on Sunday.

If they’re not, and maybe even if they are, McCourty would start his third straight game at safety.

He played there a bit last year and said he has no preference — “whatever they tell me to play” — but it’s “cool” to get a wider view of the field playing deeper and in the middle at safety.

“It’s different,” he said. “You get used to seeing more of the field and I think you have more of a responsibility since you have that viewpoint to let everyone else know, because I know when you’re playing corner it’s not as easy to see the different things that you see on film when you’re on just that side of the field. So I try to just communicate and let guys know if I see anything from film study that might happen (and) just send that alert out.”

As a first-round draft choice out of Rutgers, McCourty had seven interceptions as a rookie. But he had just two last season before some poor games at cornerback this year.

The secondary seemed headed for another one when it allowed Sam Bradford’s 50-yard touchdown pass to Chris Givens on the first series of the Patriots most recent game. But St. Louis didn’t score again and they beat the Rams 45-7 in London two weeks ago.

McCourty spent part of the bye week in Montvale, N.J., where Superstorm Sandy knocked out power to his mother’s house. He bought her a generator before the power came back on Tuesday. By that time, McCourty was back in Foxborough, preparing to play wherever coach Bill Belichick wants him.

“He’s pretty good at everything,” Belichick said. “He’s a good tackler. He’s fast. He’s instinctive. He has a good feel for the game wherever you put him in terms of leverage, angles, decisions, that kind of thing. He’s smart. He has the mental flexibility to go back and forth between assignments.”

And he’s willing to do that.

“He’s a selfless player who just wants to do whatever he can to help the team win,” safeties coach Brian Flores said. “He has all the traits: he communicates, he’s a focused player, he’s smart, he does a lot of things well. He can make that transition. A lot of guys can’t. I’m happy to have him.”

“I feel like Devin helped me out a lot,” Wilson said. “He’s kind of like a big brother to me back there and he keeps things calm because there’s so many young guys back there.”

The makeup of the secondary will change next week when Aqib Talib, acquired from the Tampa Bay Buccaneers last week, will be eligible to return after a four-game suspension for violating the NFL’s policy on performance-enhancing substances.

“This week we’ve got to just focus on who’s here and what we have to do to get a win,” McCourty said, “and then, I think, next week when all that comes into play, it’ll really help us out.”

It also could mean more time at safety for McCourty once Talib gets acclimated — a process McCourty could speed up with his experience at cornerback.

“I have a good knowledge of, especially for our corners, what they’re doing,” he said. “So I think a little bit of that helps where I can say things and I communicate with them to let them know I’m on the same page as them.”