WASHINGTON — Secretary of State John Kerry told Congress on Wednesday that it was urgent to try to revive negotiations between Israel and the Palestinians because time was running out for establishing an independent Palestinian state.

“I believe the window for a two-state solution is shutting,” Kerry told the House Foreign Affairs Committee. “I think we have some period of time, in a year to a year and a half to two years, or it’s over.”

Kerry recently returned from his third trip to the Middle East since assuming his duties as secretary of state in February. His testimony Wednesday morning was his first appearance before Congress since taking up his post.

Kerry acknowledged that relations between Palestinian and Israeli leaders were burdened by deep distrust, and he said it would be challenging to try to undo “years of failure.”

He asserted, however, that negotiating a peace settlement was possible, provided it was done carefully. “I believe we can,” he said.

On the election Sunday in Venezuela, Kerry said the Obama administration had not yet decided to recognize President-elect Nicolas Maduro as the winner.

Maduro won by a very narrow margin, according to Venezuela’s National Electoral Council, and the opposition candidate, Henrique Capriles Radonski, is challenging the outcome.

“That evaluation has to be made, and I haven’t made it,” Kerry said when asked whether the United States would recognize Maduro. “We think there ought to be a recount.”

On North Korea, Kerry repeated that the United States did not plan to resume negotiations with Pyongyang unless it took steps to show that it was prepared to eventually give up its nuclear weapons program.

Kerry said the effort to denuclearize the Korean Peninsula depended on the Chinese.

“Absent China coming to that table, I believe Kim Jong Un literally calculates, `I can get away with anything,”’ Kerry said, referring to the North Korean leader.