Kenyan shares vaulted 2 percent on Friday to their highest in five weeks as foreign investors trooped back to riskier assets in search of bargains, while the shilling firmed slightly.

The benchmark NSE-20 Share Index added 2.02 percent to close at 3,450.33 points, last touched on September20, as overseas investors tapped buying opportunities in agricultural and banking shares, and buoyed by positive local investor sentiments following two weekly gains in a row.

There is increased optimism from local investors who have observed trading activity on the NSE this week and the previous week, said Renaldo D'souza, an analyst at Genghis Capital.

The index gained 4.4 percent during the week, driven by better-than-expected nine-months earnings by banks. Shares of farming companies, which are expected to perform well this year helped by a weaker shilling that will drive up their export earnings, also supported the move higher.

Kenya's biggest bank by assets, Kenya Commercial Bank, led the gains, jumping 7.4 percent to 17.30 shillings a share, while tea and fruits producer Kakuzi rose 7.1 percent to 75.50 shillings.

The stability of the shilling is also another reason for improved activity and rising prices in the stock market, D'souza said.

In the foreign exchange market, the shilling closed just slightly firmer against the dollar, after paring some of its earlier gains, weighed on by banks covering short position ahead of the weekend.

At the 1300 GMT close of market, commercial banks quoted the shilling at 99.50/100.00 against the dollar, weaker than 98.80/99.00 where it traded earlier, but a tad firmer than Thursday's close of 99.60/100.20

Traders said spreads were wider than the usual 10 or 20 cents because of lack of liquidity in the market.

There was a bit of buying in the afternoon. Mostly short covering by banks ahead of the weekend, said a senior trader at a commercial bank.

The central bank sought to mop up 500 million shillings through a repurchase agreement offer, but received bids of just 100 million shillings and accepted them all at a weighted average rate of 22 percent..

The bank is scheduled to hold its rate-setting meeting on November 1, and market players expect further tightening measures to fight high inflation and extreme volatility in the exchange rate.

In fixed income, corporate and government bonds worth 838.8 million shillings were traded on Friday, down from 1.6 billion shillings previously.