'Out of control'
Maryna Ostapenko, an SBU spokeswoman, said that the two SBU operations were part of an investigation connected to "abuses in the gas sector".
The agents left after a confrontation with members of parliament, loyal to Yulia Tymoshenko, the country's prime minister, who had rushed to the scene.
The raids underline political tensions between Tymoshenko and Viktor Yushchenko, Ukraine's president.
The SBU reports to the president and Yushchenko backed the initial operation by its forces as a lawful criminal investigation.
The president has criticised the prime minister for her conduct in clinching a deal in January under which Ukraine is to pay more for imported Russian gas.
Addressing her cabinet on Thursday, Tymoshenko, once a close ally and now a rival of Yushchenko for the presidency, said the security forces were out of control and acting at the president's behest.
She said "The prosecutor's office is doing nothing because it has its own interests, the SBU is blatantly breaking the law and the president is covering up for them.
"This is not merely a violation of the constitution, but in essence the destruction of the very foundation of the state's legal norms."
Earlier on Thursday, Putin had said failure by Ukraine to pay its February bill could prompt Gazprom to curtail gas supplies, as it did for three weeks in January, and again cut off customers in Europe.
He said: "If as a result of law enforcement actions and arrests of a number of officials there will be no payment, it will lead to the stoppage of our energy deliveries to our customers in Ukraine as well as customer in Europe."
Jose Manuel Barroso, the European Union commission president, later voiced concern over Putin's warning.
EU countries have called for closer co-ordination between Kiev and Moscow to rule out any further problems.
Ukraine is the main transit route for Russian gas exports to Europe, and a dispute over prices with Russia in January disrupted supplies to many countries in the middle of winter.